I want to replace column integer values to empty strings (''). But, can not find appropriate way.
Current data
0
0 asd
1 9
2 gfs
3 45
4 4
5 dsf
Expected result
0
0 asd
1
2 gfs
3
4
5 dsf
I want to replace column integer values to empty strings (''). But, can not find appropriate way.
Current data
0
0 asd
1 9
2 gfs
3 45
4 4
5 dsf
Expected result
0
0 asd
1
2 gfs
3
4
5 dsf
Use str.isnumeric and df.where:
>>> series
0 asd
1 9
2 gfs
3 45
4 4
5 dsf
Name: 0, dtype: object
>>> series.where(~series.str.isnumeric(), '')
0 asd
1
2 gfs
3
4
5 dsf
Name: 0, dtype: object
If it's a dataframe, then:
>>> df.where(~df['0'].str.isnumeric(), '')
0
0 asd
1
2 gfs
3
4
5 dsf