Skip to content

Instantly share code, notes, and snippets.

@anbento0490
Last active May 2, 2020 08:16
Show Gist options
  • Save anbento0490/2ad54c083d59e49b4cc27cafa4a35593 to your computer and use it in GitHub Desktop.
Save anbento0490/2ad54c083d59e49b4cc27cafa4a35593 to your computer and use it in GitHub Desktop.
import pandas as pd
import yfinance as yf
orders = pd.read_csv('/Users/anbento/Documents/Data_Sets/Medium/customer_orders.csv',
parse_dates = ['order_date'], index_col = ['order_date'] )
orders.insert(0, 'order_month', pd.DatetimeIndex(orders.index).to_period('M') )
orders.reset_index(inplace = True)
orders.columns = ['Order Date', 'Order Month' ,'Order ID', 'Customer ID', 'Item ID', 'Item Price',
'Quantity', 'Amount Paid (£)']
print(orders.shape)
orders.head(10)
#orders.groupby('Customer ID')['Order ID'].count())
#orders.groupby('Customer ID')['Amount Paid (£)'].sum()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment