CSV文件:(样例1.csv)
Location_City, Location_State, Name, hobbies
Los Angeles, CA, John, "['Music', 'Running']"
Texas, TX, Jack, "['Swimming', 'Trekking']"
我想将CSV的兴趣爱好列转换为以下输出。
Location_City, Location_State, Name, hobbies
Los Angeles, CA, John, Music
Los Angeles, CA, John, Running
Texas, TX, Jack, Swimming
Texas, TX, Jack, Trekking
我已经将CSV文件读入到dataframe
中,但我不知道如何进行转换?
data = pd.read_csv("sample1.csv")
df=pd.DataFrame(data)
df