TypeError: Read_excel() Got An Unexpected Keyword Argument 'index' When Exporting Individual Excel Row To Json File With Pandas
I have a spreadsheet with 10 rows for example, and want to export each row to an individual JSON file name row number.json (aka row 0 would be '0.json'. However I get this error an
Solution 1:
observation, in code df = pd.read_excel("/fullpath/excel.xlsx", index=[0, 10], columns=['A'])
index and columns have no significance.
if you just want each row as json, you can use something like following and it will create json files in the same folder where script is.
for index, row in df.iterrows():
#got the row and then write the row
row.to_json(str(index)+'.json')# method from https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_json.html
Post a Comment for "TypeError: Read_excel() Got An Unexpected Keyword Argument 'index' When Exporting Individual Excel Row To Json File With Pandas"