I have 2 panda columns that looks like so:
Request Number Cost Center
1 111
2 133
3 156
NaN 235
NaN 111
NaN 123
For the NaN (null values), how can I get the Pandas dataframe to look like so:
Request Number Cost Center
1 111
2 133
3 156
Unknown1 235
Uknnown2 111
Unknown3 123
Where all null values will take the form of the string constant of unknown with the count in order?
You can modify the null values in
Request Number
using.loc
, and concatenating the string"Unknown"
to thecumsum
of null values, cast as string: