-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: DataFrame.to_dict when orient=index data loss #22810
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
Changes from all commits
8164725
616db89
9949fb7
8522e13
df58b9d
2de5e0a
51e42da
0a49ffc
abeda10
6eb2e5a
317555b
f457cd4
0da33da
4c57b78
fb2eff0
7a4240e
a5e8945
6aec074
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -373,6 +373,22 @@ is the case with :attr:`Period.end_time`, for example | |
|
||
p.end_time | ||
|
||
.. _whatsnew_0240.api_breaking.frame_to_dict_index_orient: | ||
|
||
Raise ValueError in ``DataFrame.to_dict(orient='index')`` | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Bug in :func:`DataFrame.to_dict` raises ``ValueError`` when used with | ||
``orient='index'`` and a non-unique index instead of losing data (:issue:`22801`) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a mini-example here (just showing what kind of data frame will raise). the prior example was too long, but I think we need something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added an ipython block that will raise the error. @jreback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right but now the docs will not work. so, you can do this as an ipython block but you need an also show the df after defining it |
||
.. ipython:: python | ||
:okexcept: | ||
|
||
df = pd.DataFrame({'a': [1, 2], 'b': [0.5, 0.75]}, index=['A', 'A']) | ||
df | ||
|
||
df.to_dict(orient='index') | ||
|
||
.. _whatsnew_0240.api.datetimelike.normalize: | ||
|
||
Tick DateOffset Normalize Restrictions | ||
|
Uh oh!
There was an error while loading. Please reload this page.