Open GergelyMincsovicsPhilips opened 1 year ago
In the line pd.read_csv("data.csv", index_col=[0,1,2], header=[0])
pandas has no way to know that the second line should be the index names instead of values in the index.
Having said that maybe could be an index_col_names
parameter, that you'd set to [1]
to get the names in this case. That should probably imply that the rest of that line should be empty, so we don't lose information, e.g.:
x,y,z,,
would give the index names "x", "y" & "z", while
x,y,z,1,3
should probably raise, because there would be no way to place the values 1 & 3.
Yes, indeed. I expect that there should be some way of restoring a data frame written out using to_csv.
I think this could be a good addition to the read_csv function. Are you up for making a PR on this?
is not this a PR? not sure what additional info I could provide
Hey, no this is an issue (i.e. where bugs, enhancements etc. are discussed, before submitted a PR).
A PR (Pull Request) is actually submitted code to fix an issue. See the pane "Pull requests" for all open PRs.
oh ok, I thought of a problem report well, not on the short term, I could help testing though
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[ ] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
read_csv does not support df.columns.names df != df2
Expected Behavior
df==df2
Installed Versions