Skip to content

BUG: fillna upconversion on Frame #3386

Closed
@jreback

Description

@jreback

Thought had fixed this.....but guess not

http://stackoverflow.com/questions/16067144/in-pandas-how-to-use-fillna-to-fill-the-whole-columns-with-string-if-the-column/16067653#16067653

In [2]: csv=u"""a,a,,a
b,b,,b
c,c,,c
"""

In [3]: df = pd.read_csv(StringIO(csv), header=None)

In [4]: df
Out[4]: 
   0  1   2  3
0  a  a NaN  a
1  b  b NaN  b
2  c  c NaN  c

In [5]: df.dtypes
Out[5]: 
0     object
1     object
2    float64
3     object
dtype: object

In [6]: df.fillna({ 2: 'foo' })

ValueError: could not convert string to float: foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions