image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

hits = pd.read_csv('../input/hits.csv')
musics = pd.read_csv('../input/music_data.csv')
genre = pd.read_csv('../input/genre.csv')
state = pd.read_csv('../input/state.csv')

hits.columns

musics.columns

genre.columns

state.columns

df = hits.merge(genre, on='genre_id').merge(state, on='state_id').merge(musics, on='music_id')

df.columns

df.query('user_id==878')

df.groupby(by='genre')['user_id'].count().sort_values(ascending=False)

plt.xticks(rotation=50)

df.groupby(by='state')['user_id'].count().sort_values(ascending=False)

plt.xticks(rotation=50)

corrmat = df.corr()
sns.set(font_scale=1)
fig, ax = plt.subplots(figsize=(10,10))
sns.heatmap(corrmat, vmax=1, vmin=-1, square=True, annot=True);

fig, ax = plt.subplots(figsize=(10, 10))
ax.scatter(df['duration'], df['value'])
ax.set_title('Music Dataset')
ax.set_xlabel('Duration')
ax.set_ylabel('Value')