Filling Missing Values Pandas Dataframe By Specific Value
I have a dataset and I want to fill the missing data in the column 'value' with bfill with adding a string to it. Here is to code that I have: import pandas as pd import numpy as
Solution 1:
IIUC
s=df.value.bfill()
s.loc[df.value.isnull()]=s.astype(int).astype(str)+'5D'
s
Out[771]:
0 1
1 25D
2 25D
3 2
4 3
5 1
6 3
7 35D
8 3
Name: value, dtype: object
Post a Comment for "Filling Missing Values Pandas Dataframe By Specific Value"