Let’s say I have a dataframe like this:
import pandas as pd
import numpy as np
df = pd.DataFrame([[1, np.nan, 2],
[2, 3, 'I'],
[3, 4, 'II']], columns=['A', 'B', 'C'])
df
how do I identify all the strings exclude null values and if it’s a roman number, convert it into the integer correspond to this roman number?
I tried res = np.argwhere(df_pre.values.astype('str'))
to locate the coordination of string but it includes the null values.
New contributor
MicH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.