Skip to content

Fix to_frame name to not pass None#8554

Merged
jsignell merged 2 commits intodask:mainfrom
jsignell:to_frame-name
Jan 19, 2022
Merged

Fix to_frame name to not pass None#8554
jsignell merged 2 commits intodask:mainfrom
jsignell:to_frame-name

Conversation

@jsignell
Copy link
Member

@jsignell jsignell commented Jan 11, 2022

This fixes some of the groupby tests on pandas upstream, but I'm not sure if it's the right approach.

The issue is that pandas treats None differently than it used to. This is the behavior in nightly pandas:

import pandas as pd

s = pd.Series([1,3,4], name="foo")
s.to_frame()
#    foo
# 0    1
# 1    3
# 2    4

s.to_frame(name=None)
#    NaN
# 0    1
# 1    3
# 2    4

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

I think this is a fine solution. As mentioned in the pandas issue, you could also use pd.api.extensions.no_default, but that is only available since pandas 1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants