I have two dataframes: one for sales other for customers.
I need to create a third dataframe, but using merge doesn't work:
df1 = pd.read_csv('sales.csv', sep=';')
df2 = pd.read_csv('cust.csv', sep=';')
df1.shape = (423413, 21)
df2.shape = (231286, 12)
of course, some customers made more than one purchase. But when I use merge, the dataframe is bigger than the sum of the two previous dataframes and it doesn't matter which method: inner, outer, right, left. Always give a value greater than the sum of the two
data_sum = df1.merge(df2, on='Id_Customer', how='left')
data_sum.shape = (745711, 32)
I've been trying to merge, join, concat and nothing works
Some customers made more than one purchase and customers who never purchased anything. How could I create a new dataframe that looks up the sales table ID, finds the reference in the customers table, and presents the sales and customer data in this?