I want change all strings in the pandas DF to the corresponding* integers. I can use this routine:
k=0
for item in df['someColumn'].unique():
df.replace(item, k)
k += 1
or even I can do list comprehension... Anyway I want to ask, does somebody know about probably some specific method in Pandas, which could replace ALL strings in some column with the corresponding (=different) integer (or float) values..? Please, propose only pythonic way.
Probably some additional aspect. My column doesn't have some numeric values in the string format, just really strings (= concatenation of the chars):
C
asd
bbd
ksl
asd
asd
ksl
I want
C
1
2
3
1
1
3
*Probably the word corresponding is a little bit confusing here, I'm very sorry