BUG: dtype lost in DataFrame.append by jbrockmendel · Pull Request #43392 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation3 Commits3 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@jbrockmendel

  1. For BlockManager, this improves dtype-retention, see test_append_same_columns_type
  2. For ArrayManager, this fixes an unwanted casting to object, see test_append_empty_frame_to_series_with_dateutil_tz
  3. I'm increasingly confident that with this, we can get rid of several kludges in internals.concat
  4. This does change the order of columns in some cases, see test_append_empty_frame_to_series_with_dateutil_tz. AFAICT this is due to a bug in union_indexes (but fixing it breaks other things that i need to run down), xref BUG: concat still sorts columns if they differ #43375

@jbrockmendel

jreback

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a minor change but is still user facing if you can add a note

[[1.0, 2.0, 3.0], [4, 5, 6], [7, 8, np.nan]], index=[0, 1, 2], columns=index
[[1, 2, 3.0], [4, 5, 6], [7, 8, np.nan]], index=[0, 1, 2], columns=index
)
# integer dtype is preserved for columns present in ser.index

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert_frame_equal compares these dtypes no? (i guess ok that you are being explicit as well)

@jbrockmendel

@jbrockmendel

@jbrockmendel

jreback

feefladder pushed a commit to feefladder/pandas that referenced this pull request

Sep 7, 2021

@jbrockmendel @feefladder

Labels

2 participants

@jbrockmendel @jreback