Skip to content
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

DataFrame populated with the letter "n" when no data passed and dtype is specified as str #9428

Closed
ajcr opened this issue Feb 6, 2015 · 1 comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Milestone

Comments

@ajcr
Copy link
Contributor

ajcr commented Feb 6, 2015

This is discussed on Stack Overflow here.

When constructing a DataFrame with the dtype as str but not passing in any data (just an index), the resulting DataFrame is filled with the letter n:

In [61]: pd.DataFrame(index=range(2), columns=[0], dtype=str)
Out[61]: 
   0
0  n
1  n

This is contrary to the behaviour of Series when no data is passed in:

In [62]: pd.Series(index=range(2), dtype=str)
Out[62]: 
0    NaN
1    NaN
dtype: object

It would be logical for the DataFrame to be populated with NaN in this instance too.

@ajcr ajcr changed the title DataFrame filled with letter "n" when no data passed and dtype is specified as str DataFrame populated with the letter "n" when no data passed and dtype is specified as str Feb 6, 2015
@jreback jreback added the Bug label Feb 6, 2015
@jreback jreback added this to the 0.16.0 milestone Feb 6, 2015
@jreback jreback added the Dtype Conversions Unexpected or buggy dtype conversions label Feb 6, 2015
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 5, 2015
@jreback jreback modified the milestones: 0.17.0, Next Major Release Jul 23, 2015
@jreback
Copy link
Contributor

jreback commented Jul 25, 2015

closed by #10658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

No branches or pull requests

2 participants