Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Oct 10, 2020
Embed
What would you like to do?
df = pd.read_csv('vgsales.csv')
percent_missing = df.isnull().sum() * 100 / len(df)
missing_values = pd.DataFrame({'column_name': df.columns,
'percent_missing': percent_missing})
labels = df['Genre']
imputer = CategoricalImputer()
df['Year'] = imputer.fit_transform(df['Year'].values)
df['Publisher'] = imputer.fit_transform(df['Publisher'].values)
percent_missing = df.isnull().sum() * 100 / len(df)
missing_values = pd.DataFrame({'column_name': df.columns,
'percent_missing': percent_missing})
df = df.drop(['Rank', 'Year'], axis=1)
df = df.apply(preprocessing.LabelEncoder().fit_transform)
enc_labels = df['Genre']
df = pd.get_dummies(df)
plt.rcParams['legend.fontsize'] = '16'
df2 = df.drop(['Genre'], axis=1)
df2['Genre'] = labels
#df.plot(figsize=(10,10), fontsize=24)
fig = plt.figure(figsize=(10,7))
ax = fig.add_subplot(111)
ax.set_title("Parallel Coordinates Example", fontsize=20)
ax.tick_params(axis='x', rotation=30)
ax.tick_params(axis='both', labelsize=20)
parallel_coordinates(df2, class_column='Genre', ax=ax)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment