MOOC作业练习15

已知有一个列表中存放了一组音乐数据: 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

你可能感兴趣的:(MOOC,笔记)