text_html_output_1.png
from sklearn import linear_model

import matplotlib.pyplot as plt

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

df = pd.read_csv('../input/prediction-of-music-genre/music_genre.csv')

import seaborn as sns
import matplotlib.pyplot as plt

df_mr = df.drop(columns=[i for i in df.columns if i not in ['popularity', 'tempo', 'instrumentalness']])

df_mr.tempo = df_mr.tempo.apply(lambda row: str(row).replace('?', '0') if row == '?' else str(row))
df_mr.tempo = df_mr.tempo.apply(pd.to_numeric, errors='coerce')
df_mr = df_mr.dropna()

x = df_mr[['instrumentalness', 'tempo']]
y = df_mr['popularity']

from sklearn import linear_model
regr = linear_model.LinearRegression()
regr.fit(x, y)