i new pandas module, , trying create pivot table excel file.
here's code:
excel = pd.excelfile(filename) df = excel.parse df1 = df[['product description', 'supervisor']] table1 = pd.pivot_table(df1, index = ['supervisor'], columns = ['product description'], values = ['product description'], aggfunc = [lambda x: len(x)], fill_value = 0) writer = pd.excelwriter(filename) table1.to_excel(writer, 'pivot table') writer.save() workbook.save(filename)
it's giving me error: typeerror: 'instancemethod' object has no attribute '__getitem__'
supervisor , product description 2 columns i'm using create pivot table. error happening because can't reference columns that? supervisor , product description values in first cell of each column. have reference columns in other way?
parse
method (function attached object). need parentheses after method name i.e. df = excel.parse()
.
see the docs details on how supply arguments function call.
Comments
Post a Comment