I want to create a set in which only the string values of a column appear. The numerical values of the column are to be stored in another set.
You can use:
df['numeric'] = pd.to_numeric(df['col'], errors='coerce')
df['non-numeric'] = df['col'].mask(df['numeric'].notna())
Example:
col numeric non-numeric
0 abc NaN abc
1 123 123.0 NaN
2 123 123.0 NaN
3 NaN NaN NaN
Used input:
df = pd.DataFrame({'col': ['abc', 123, '123', float('nan')]})