-
Notifications
You must be signed in to change notification settings - Fork 0
/
pav.py
81 lines (56 loc) · 2.51 KB
/
pav.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import requests
import csv
import sklearn
csv_path='Retail.csv'
df=pd.read_csv(csv_path, nrows=200)
df.head()
df_new = df.iloc[:, [0,1,3,4,5,6,7]]
df_new= pd.DataFrame(df_new)
print(df_new)
print("-----------------------------------------------------------------")
ci=int(input("Enter Your Customer Id: "))
td = input("Enter date: \n >> ")
cd=df_new.groupby('Country')['CustomerID'].count()
print(cd)
print("-----------------------------------------------------------------")
uk=df[df['Country'] == 'United Kingdom'].groupby("CustomerID")["Quantity"].sum()
z=df[df['CustomerID'] == ci]['Quantity'].sum()
tc=df["TotalPrice"] = df['Quantity'] * df['UnitPrice']
tc=df[df['CustomerID'] == ci]["TotalPrice"].sum()
print(uk)
print("-----------------------------------------------------------------")
fr=df[df['Country'] == 'France'].groupby("CustomerID")["Quantity"].sum()
y=df[df['CustomerID'] == ci]["Quantity"].sum()
tc=df["TotalPrice"] = df['Quantity'] * df['UnitPrice']
tc=df[df['CustomerID'] == ci]["TotalPrice"].sum()
print(fr)
print("-----------------------------------------------------------------")
au=df[df['Country'] == 'Australia'].groupby("CustomerID")["Quantity"].sum()
x=df[df['CustomerID'] == ci]["Quantity"].sum()
tc=df["TotalPrice"] = df['Quantity'] * df['UnitPrice']
tc=df[df['CustomerID'] == ci]["TotalPrice"].sum()
print(au)
print("-----------------------------------------------------------------")
if ci in uk:
print("This Customer Is From The UK And Has A Budget Of :$",tc)
print("Please Refer To The Recommendations.csv File To View Our Recommendations That Fall In Your Budget ")
elif ci in fr:
print("This Customer Is From France And Has A Budget Of :$",tc)
print("Please Refer To The Recommendations.csv File To View Our Recommendations That Fall In Your Budget ")
elif ci in au:
print("This Customer Is From Australia And Has A Budget Of :$",tc)
print("Please Refer To The Recommendations.csv File To View Our Recommendations That Fall In Your Budget ")
df_new1=df.iloc[:,[2,4,6]]
df_new1=df_new1[df_new1['CustomerID'] == ci]
df_new1=pd.DataFrame(df_new1)
df_new1=df_new1.to_csv('recommendations.csv', index=False)
csv_path='recommendations.csv'
df=pd.read_csv(csv_path, nrows=200)
df.head()
df_new = df.iloc[:, [1,2,3]]
df_new= pd.DataFrame(df_new)
print(df_new)
print("-----------------------------------------------------------------")