I am outputting a pandas dataframe to a json object using the following:
df_as_json = df.to_json(orient='split')
In the json object superfluous indexes are stored. I do no want to include these.
To remove them I tried
df_no_index = df.to_json(orient='records')
df_as_json = df_no_index.to_json(orient='split')
However I get a
AttributeError: 'str' object has no attribute 'to_json'
Is there a fast way to reorganize the dataframe so that is does not contain a separate index column during or prior to the .to_json(orient='split') call?
to_json
doesn't return a pandas data frame and therefore the next call ofto_json
cannot work.