Horje
convert categorical column to int in pandas Code Example
column dataframe to int
df[[column_name]].astype(int)
convert a pandas column to int
# convert Series
my_series = pd.to_numeric(my_series)

# convert column "a" of a DataFrame
df["a"] = pd.to_numeric(df["a"])
convert categorical column to int in pandas
from sklearn import preprocessing

lab_encoder = preprocessing.LabelEncoder()
df['column'] = lab_encoder.fit_transform(df['column'])




Python

Related
merge multiple excel workssheets into a single dataframe Code Example merge multiple excel workssheets into a single dataframe Code Example
import this Code Example import this Code Example
python print string name in pattern Code Example python print string name in pattern Code Example
logout redirect url Code Example logout redirect url Code Example
tkinter Code Example tkinter Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7