Case Study # 1 (1)

.docx

School

Humber College *

*We aren’t endorsed by this school

Course

150

Subject

Computer Science

Date

Feb 20, 2024

Type

docx

Pages

4

Uploaded by UltraFireGoose38

Report
import os import calendar import numpy as np import networkx as nx import pandas as pd from pandas.plotting import scatter_matrix, parallel_coordinates import seaborn as sns from sklearn import preprocessing import matplotlib.pylab as plt In [4]: credit_df = pd . read_csv(‘ Product Demand.csv ) In [6]: --credit_df = credit_df . rename(columns = {'Card Type': 'Card_Type'}) In [7]: --credit_df = credit_df . rename(columns = {'Exp Type': 'Exp_Type'}) In [40]: credit_df . head(9) Out[40]: City Date Card_Type Exp_Type Gender Amount 0 Delhi, India 29-Oct-14 Gold Bills F 82475 1 Greater Mumbai, India 22-Aug-14 Platinum Bills F 32555 2 Bengaluru, India 27-Aug-14 Silver Bills F 101738 3 Greater Mumbai, India 12-Apr-14 Signature Bills F 123424 4 Bengaluru, India 5-May-15 Gold Bills F 171574 5 Delhi, India 8-Sep-14 Silver Bills F 100036 6 Delhi, India 24-Feb-15 Gold Bills F 143250 7 Greater Mumbai, India 26-Jun-14 Platinum Bills F 150980 8 Delhi, India 28-Mar-14 Silver Bills F 192247 In [41]: credit_df . tail(5) Out[41]:
City Date Card_Type Exp_Type Gender Amount 2604 7 Kolkata, India 22-Jun-14 Silver Travel F 128191 2604 8 Pune, India 3-Aug-14 Signature Travel M 246316 2604 9 Hyderabad, India 16-Jan-15 Silver Travel M 265019 2605 0 Kanpur, India 14-Sep- 14 Silver Travel M 88174 2605 1 Hyderabad, India 19-Oct-13 Signature Bills M 184410 In [42]: credit_df . info() <class 'pandas.core.frame.DataFrame'> RangeIndex: 26052 entries, 0 to 26051 Data columns (total 6 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 City 26052 non-null object 1 Date 26052 non-null object 2 Card_Type 26052 non-null object 3 Exp_Type 26052 non-null object 4 Gender 26052 non-null object 5 Amount 26052 non-null int64 dtypes: int64(1), object(5) memory usage: 1.2+ MB In [43]: credit_df . isnull() . sum() Out[43]: City 0 Date 0 Card_Type 0 Exp_Type 0 Gender 0 Amount 0 dtype: int64 In [49]: credit_df['City'] . value_counts() Out[49]: Bengaluru, India 3552 Greater Mumbai, India 3493
Ahmedabad, India 3491 Delhi, India 3482 Hyderabad, India 784 ... Rayagada, India 1 Varanasi, India 1 Hugli-Chinsurah, India 1 Alirajpur, India 1 Fazilka, India 1 Name: City, Length: 986, dtype: int64 In [83]: ax = credit_df . groupby('Card_Type') . count() . Amount . plot(kind = 'bar') ax . set_ylabel('Amount') Out[83]: Text(0, 0.5, 'Amount') In [66]: ax = credit_df . groupby('Card_Type') . sum() . Amount . plot(kind = 'bar') ax . set_ylabel('Amount') Out[66]: Text(0, 0.5, 'Amount')
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
In [88]: pip install python - gmaps Collecting python-gmaps Downloading python_gmaps-0.3.1-py2.py3-none-any.whl (13 kB) Requirement already satisfied: pytz in c:\users\fares\anaconda3\lib\site- packages (from python-gmaps) (2022.1) Requirement already satisfied: requests in c:\users\fares\anaconda3\lib\site- packages (from python-gmaps) (2.28.1) Requirement already satisfied: certifi>=2017.4.17 in c:\users\fares\anaconda3\ lib\site-packages (from requests->python-gmaps) (2022.9.14) Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\fares\ anaconda3\lib\site-packages (from requests->python-gmaps) (1.26.11) Requirement already satisfied: charset-normalizer<3,>=2 in c:\users\fares\ anaconda3\lib\site-packages (from requests->python-gmaps) (2.0.4) Requirement already satisfied: idna<4,>=2.5 in c:\users\fares\anaconda3\lib\ site-packages (from requests->python-gmaps) (3.3) Installing collected packages: python-gmaps Successfully installed python-gmaps-0.3.1 Note: you may need to restart the kernel to use updated packages. In [101]: import gmaps