-
-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
index=False by default when exporting dataframes #34576
Comments
We can leave this open for a bit, but I don't think changing this is feasible. In my experience, This overlaps with an ongoing about an "optional index". I wasn't able to turn up the issue in a quick search. |
agree with @TomAugspurger here note this is why we had a Dataframe.from_csv method with different reading defaults, but that was just confusing and has since been removed |
I personally agree with @JavierLTPromofarma that the default of I think a non-meaningful index is not an anti-pattern. Basically whenever you don't explicitly set one of your columns as the index, you often have a meaningless index. And unless you want to take advantage of easier indexing by setting your column as the index (or from timeseries functionality), setting a column as the index is not always that important. What we did in GeoPandas' Now, the way we can change this is probably rather through the "optional" index idea, as Tom mentioned. We have an old issue about it here: wesm/pandas2#17. |
From a UX standpoint the default is less than ideal. The fact that a simple
df:
df2:
This has caused me headaches before when swapping runtime created dataframes with dataframes read from csv. The |
Thanks for the suggestion, but it appears unlikely that |
I have been bothered by this for years - just not enough to do anything about it. but I think the community as a whole would much much much rather have False be the default. Only on rare occasions is the index a meaningful column. Is there a way to ask the community - like a vote or something? |
@DanTaranis for president. |
Is your feature request related to a problem?
Every single time I have exported a dataframe (usually with .to_csv), I have not needed the index.
Describe the solution you'd like
Change the default from True to False.
API breaking implications
All code that has not explicitely set index=True should make it.
Describe alternatives you've considered
Leave things as they are now.
Not using the index is something usual or am I biased by my own experience?
The text was updated successfully, but these errors were encountered: