-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Document column order in MultiIndex.to_frame #22662
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
Comments
That comes from http://pandas.pydata.org/pandas-docs/version/0.23/whatsnew.html#instantiation-from-dicts-preserves-dict-insertion-order-for-python-3-6. Can you make a PR updating the docstring to indicate that the order follows the same results as the |
Can do. @TomAugspurger, just to confirm, when you say link to those docs is the general practice to put that in a
vs
|
A see also is fine I think.
You'll need a blank line between to first and second lines to pass the
docstring validator.
…On Tue, Sep 11, 2018 at 11:20 AM Matthew Gilbert ***@***.***> wrote:
Can do. Just to confirm, when you say link to those docs is the general
practice to put that in a See Also section? Or actually add a hyperlink?
i.e.
"""
Create a DataFrame with the levels of the MultiIndex as columns.
Column ordering is determined by the DataFrame constructor with data as a
dict.
.. versionadded:: 0.20.0
Parameters
----------
index : boolean, default True
Set the index of the returned DataFrame as the original MultiIndex.
Returns
-------
DataFrame : a DataFrame containing the original MultiIndex data.
See also
--------
DataFrame
"""
vs
"""
Create a DataFrame with the levels of the MultiIndex as columns.
Column ordering is determined by the DataFrame constructor with data as a
dict.
.. versionadded:: 0.20.0
Parameters
----------
index : boolean, default True
Set the index of the returned DataFrame as the original MultiIndex.
Returns
-------
DataFrame : a DataFrame containing the original MultiIndex data.
Notes
-----
A discussion on the ordering of DataFrames can be found athttps://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html
"""
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#22662 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHImUPMnNir-qkB_62hbazsUltch8uks5uZ-K0gaJpZM4WjjP5>
.
|
Problem description
The ordering of columns from
pandas.MultiIndex.to_frame
varies inpython=3.5
vspython=3.6
and the expected behaviour is not defined in the docs.Expected Output
I would expect columns to be in the order of the
MultiIndex
levels. Barring that I would expect the columns to be lexicographical sorted, although I find that to be less intuitive.Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: