import pandas as pd
df = pd.read_csv("vend.csv")
shape = df.shape
print(shape)
df.dtypes["Location"]
x = df.iloc[2420]
type(x)
x.loc["Location"]
# no difference between x.loc["Location"] and x["Location"]
# x("Location") is not valid syntax for pandas
type(x.loc["Location"])
df_sub = df[df["Location"] == x.loc["Location"]]
a = df[df["Location"] == x.loc["Location"]].shape[0]
print(a)
df_sub.loc[13,"Transaction"]
b = 2
c = 6
df_sub.iloc[b,c]
d = df_sub[(df_sub["RPrice"] == 1.5) & (df_sub["RQty"] == 2)]["Product"]
print(d)
e = df[df["RPrice"] != df["MPrice"]].index[0]
print(e)
my_tuple = (a,b,c,d,e)
import pickle
with open("wkst2-ans.pickle", 'wb') as f:
pickle.dump(my_tuple, f)
with open("wkst2-ans.pickle", 'rb') as f:
x = pickle.load(f)