-
Notifications
You must be signed in to change notification settings - Fork 6
replace arg 'transpose' by 'wide' in to_csv and to_excel (issues 371 + 549 + 575) #576
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
replace arg 'transpose' by 'wide' in to_csv and to_excel (issues 371 + 549 + 575) #576
Conversation
this is related to #371 too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Just one thing worries me, it is the upgrade path if somebody used to_excel(transpose=True). Is it possible to somehow get the old behaviour? If so it should be mentioned how to get it in the release notes. If not, we will need to discuss this some more :)
""" | ||
Converts LArray into Pandas Series. | ||
|
||
Parameters | ||
---------- | ||
name : str, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a changelog note about this?
larray/core/array.py
Outdated
replace NA values with na_rep. Defaults to ''. | ||
wide : boolean, optional | ||
Whether or not writing arrays in "wide" format. If True, arrays are exported with the last axis | ||
represented horizontally. If False, arrays are exported in "narrow" format: all axes and also the values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"all axes and also the values are written as columns". This formulation is a bit weird => use something like "one column per axis plus one value column" instead?
@@ -234,6 +233,50 @@ Miscellaneous improvements | |||
|
|||
Closes :issue:`548`: | |||
|
|||
* replaced argument `transpose` by `wide` in `to_csv` and `to_excel` methods. The new argument `wide` has |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe split this in two separate sections:
- to_csv(transpose -> wide), which does not need any example/explanation because it is a simple rename.
- to_excel(transpose -> wide) which does need an explanation since the behaviour is slightly different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my previous "general comment" (not tied to particular lines) still stands.
Doh. I didn't say you needed to revert the change. I just wanted to discuss this some more. I am unsure it is worth keeping both arguments as it is likely to confuse users. As far as I can tell, for 1D arrays, wide=False and transpose=True should give almost the same result (I think the only difference will be the name of the column), for 2D arrays, a.to_excel(transpose=True) should be equivalent to a.T.to_excel() and for >2D arrays, I don't know what transpose=True does :) |
The following file contains examples using flags Some users may find the If we keep |
Thanks for this nice test file. Something like this should be in the "excel" part of the tutorial and MAYBE an abridged version should be in the changelog or at least something explaining the difference between the two arguments (not necessarily with examples) |
|
||
* added argument `name` to `to_series` method allowing to set a name to the Pandas Series returned by the method: | ||
|
||
>>> arr = ndtest((2, 3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if having an example is worth the space for a little used feature.
larray/core/array.py
Outdated
@@ -5923,8 +5969,14 @@ def to_excel(self, filepath=None, sheet_name=None, position='A1', overwrite_file | |||
header : bool, optional | |||
Whether or not to write a header (axes names and labels). Defaults to True. | |||
transpose : bool, optional | |||
Whether or not to transpose the resulting array. This can be used, for example, for writing one dimensional | |||
arrays vertically. Defaults to False. | |||
Whether or not to transpose the resulting array. Defaults to False. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs more explanation and/or an example. Maybe also saying that for 2D, it is equivalent to arr.transpose().to_excel()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nice work, as usual...
3ab4818
to
090a1f8
Compare
…'transpose' of to_csv as 'wide' + added argument 'wide' to to_excel
090a1f8
to
10afd09
Compare
…to set the name of the last column (i.e. the one containing the values) when exporting to csv/excel with wide=False
10afd09
to
734e095
Compare
No description provided.