SongsPredDataIntegration



In [ ]:
import pandas as pd

df1=pd.read_csv('Billboard2017Songs.csv')
df1=df1.apply(lambda x:x.astype(str).str.lower())

df2=pd.read_csv('SongReleased2017WithFeatures.csv')
df2=df2.apply(lambda x:x.astype(str).str.lower())

df1.insert(loc=3,column='Label',value='Yes')

df2=df2.drop_duplicates(['Name','Artists'],keep='first').reset_index(drop=True)

df3=pd.merge(df1,df2,how='right',on=['Name','Artists'])

df3.Label=(df3.Label).astype(str)
df3.Label=df3.Label.replace('nan','No')
for column in df3:
    if column=='Unnamed: 0_x' or column=='Unnamed: 0_y':
        df3=df3.drop([column],axis=1)
df3.to_csv('SongsPred.csv')