File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import pathlib
2+ import pandas as pd
3+
4+ etsy = pathlib .Path (r'folder for your esty reports' )
5+ files = etsy .iterdir ()
6+ df = pd .DataFrame ()
7+
8+ for f in files :
9+ if f .name .endswith ('.csv' ):
10+ df = df .append (pd .read_csv (f ), ignore_index = True )
11+
12+
13+ df ['Amount' ].replace ('--' ,'CA$0' ,inplace = True )
14+ df ['Fees & Taxes' ].replace ('--' ,'CA$0' ,inplace = True )
15+
16+ df ['Amount' ] = df ['Amount' ].str .split ('$' ,expand = True )[1 ].astype (float )
17+ df ['Fees & Taxes' ] = df ['Fees & Taxes' ].str .split ('$' ,expand = True )[1 ].astype (float )
18+ df .to_excel (etsy / 'detailed_etsy_report_2022.xlsx' , index = False )
19+
20+ summary = df .groupby ('Type' ).agg ({'Amount' :'sum' ,'Fees & Taxes' :'sum' })
21+ summary .loc ['total' ] = summary .sum (numeric_only = True , axis = 0 )
22+
23+ summary .to_excel (etsy / 'etsy_report_2022.xlsx' )
You can’t perform that action at this time.
0 commit comments