-
-
Save amankharwal/886e1b2e641493129c055c5bb2e7d92c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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