text_html_output_1.png
import pandas as pd

df = pd.read_csv('../input/renfe.csv')

df.isna().sum()

df.dropna(inplace=True)

df.drop(['Unnamed: 0'], axis=1, inplace=True)
df.drop(['insert_date'], axis=1, inplace=True)

df['train_type'].value_counts().plot(kind='bar')
k = df['train_type'].unique()
l = [x for x in range(len(k))]
print('Numbers used to encode different train types', l)
df['train_type'].replace(k, l, inplace=True)