Skip to content

apply fails when some data is None #1243

@mirage007

Description

@mirage007

In [91]: from pandas import DataFrame

In [92]: a = DataFrame([1,2, None, 3, 4])

In [93]: a
Out[93]:
0
0 1
1 2
2 None
3 3
4 4

In [94]: a.apply(lambda x: str(x[0]), axis=1)
Out[94]:
0 1
1 2
2 None
3 3
4 4

In [95]: a.apply(lambda x: int(x[0]), axis=1)
Out[95]:
0 1
1 2
2 NaN
3 NaN
4 NaN


I was expecting elements 3 and 4 to still evaluate properly in this case to something like this:

0 1
1 2
2 NaN
3 3
4 4

i am using windows xp 32 bit with pandas 0.7.1 on python 2.7.2

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