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

Comments

Projects
None yet
2 participants
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 changed the title from DataFrame filled with letter "n" when no data passed and dtype is specified as str to DataFrame populated with the letter "n" when no data passed and dtype is specified as str Feb 6, 2015

jreback added the Bug label Feb 6, 2015

jreback added this to the 0.16.0 milestone Feb 6, 2015

jreback added the Dtypes label Feb 6, 2015

@jreback jreback modified the milestone: 0.16.0, Next Major Release Mar 5, 2015

@jreback jreback modified the milestone: 0.17.0, Next Major Release Jul 23, 2015

Contributor

jreback commented Jul 25, 2015

closed by #10658

jreback closed this Jul 25, 2015

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