-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Regression: to_csv and multiindex columns with header kw #5539
Comments
It seems that "header" is simple ignored :-( This also does not work:
|
This finally worked: [...]
cols = [var + "_" + agg for (var, agg) in df_grouped.columns]
df_grouped.columns = cols
output = StringIO.StringIO()
df_grouped.to_csv(output)
index = output.getvalue().split("\n")[0].split(",")
expected_index = groupby_variables + cols
print(index == expected_index)
print(index)
print(expected_index) # And worked in october 2012!
True
['a', 'b', 'c_mean', 'c_std', 'c_amin', 'c_amax', 'd_mean', 'd_std', 'd_amin', 'd_amax']
['a', 'b', 'c_mean', 'c_std', 'c_amin', 'c_amax', 'd_mean', 'd_std', 'd_amin', 'd_amax'] |
This is your first example on master
|
I did use master (or something a few days old). I found that very surprising, as my "half a year old code" broke with the newer pandas due to this (I wanted to import that into R). Also:
Collab Edit: #4797 |
might not be well tested with a column multi index - and is actually very odd in that case anyhow marking as a bug/API issue for 0.14 |
Previously, MultiIndex columns weren't being overwritten when header was passed in for to_csv. Closes pandas-devgh-5539
Previously, MultiIndex columns weren't being overwritten when header was passed in for to_csv. Closes pandas-devgh-5539
Previously, MultiIndex columns weren't being overwritten when header was passed in for to_csv. Closes gh-5539
Previously, MultiIndex columns weren't being overwritten when header was passed in for to_csv. Closes pandas-devgh-5539
Previously, MultiIndex columns weren't being overwritten when header was passed in for to_csv. Closes pandas-devgh-5539
Previously, MultiIndex columns weren't being overwritten when header was passed in for to_csv. Closes pandas-devgh-5539 (cherry picked from commit e1f3a70)
This used to work (October 2012), but doesn't anymore:
Probably related to #3575
The text was updated successfully, but these errors were encountered: