I have a dataframe in pandas I need to write to hdf using the df.to_hdf call. I have ensured that I don’t have a column named ‘Index’ and I have put index=False in the call, but the index column appears in the output hdf file anyway. What am I missing? (I am using pandas version 1.5.1 and Python 3.9.12).
Here is the code to do the write:
df_total.to_hdf(os.path.join(target),key='Data', mode='w',format='table', index=False, data_columns = ('year','month','day','hour','min','sec','recno','kindat','kinst', 'ut1_unix','ut2_unix','call_sign_tx','txlat','txlon','call_sign_rx', 'rxlat','rxlon','tfreq','sn','smode','ssrc','pthlen','latcen','loncen') , complevel=9, complib='zlib')
I have tried this both with the columns explicitly listed as above, and letting it include all the columns. There is a screenshot of the HDFView showing the index was created even with index=False.