Analysis and visualization of different insights
import pandas as pd
url = 'https://raw.githubusercontent.com/DataThinkers/Datasets/main/DS/Ecommerce%20Purchases' def read_data_git(): ex1 = pd.read_csv(url) return ex1
ecommerce=read_data_git() ecommerce.head(1)
data=ecommerce.copy()
data.head(2)
data.isnull().sum()
data.dtypes
data.shape
data.columns
print('Highest purchase price',data['Purchase Price'].max())
print('Lowest purchase price',data['Purchase Price'].min())
print('Average purchase price -',data['Purchase Price'].mean())
len(data[data['Language']=='fr'])
len(data[data['Job'].str.contains('engineer',case=False)])
data.columns
data[data['IP Address']== '132.207.160.22'][['Email','Company']]
len(data[(data['CC Provider'] == 'Mastercard') & (data['Purchase Price']>=50)])
data[data['Credit Card']== 4664825258997302]['Email']
len(data[data['AM or PM']=='AM'])
len(data[data['AM or PM']=='PM'])
data['AM or PM'].value_counts()
data2=ecommerce.copy()
def fun(): count=0 for date in data2['CC Exp Date']: if date.split('/')[1]=='20': count=count+1 print(count)
fun()
data2['Ex_Year'] = data2['CC Exp Date'].str[3:5]
data2.head(2)
len(data2[data2['Ex_Year'] == '20'])
len(data2[data2['CC Exp Date'].apply(lambda x:x[3:]=='20')])
data2['Email_last'] = data2['Email'].apply(lambda x:x.split('@')[1]) data2.head(2)
Top_5 = data2['Email_last'].value_counts() Top_5.head(5)