已知有一个列表中存放了一组音乐数据: music_data = [(“the rolling stones”,“Satisfaction”),(“Beatles”,“Let It Be”),(“Guns N’ Roses”,“Don’t Cry”),(“Metallica”,“Nothing Else Matters”)] 请根据这组数据创建一个如下的DataFrame:
>>> import pandas as pd
>>> music_data = [("the rolling stones","satisfaction"),("Beatles","Let it Be"),("Guns N'Roses","Don't Cry"),("Metallica","Nothing Else Matters")]
>>> frame = pd.DataFrame(data,index=range(1,5),columns=('singer','song_name'))
>>> frame
singer song_name
1 the rolling stones satisfaction
2 Beatles Let it Be
3 Guns N'Roses Don't Cry
4 Metallica Nothing Else Matters