Python列表到数据帧

Python列表到数据帧,python,Python,我想将列表转换为数据帧。挑战在于列表中的项目如下所示,我需要将列表中每个项目的字符串值提取到数据帧的一列中 列表看起来像 Keyword = [('Hello',2.0),('Welcome',3.0),('To',3.0),('Python',4.0)] 需要数据帧作为 输出: Keyword Score 0 Hello 2.0 1 Welcome 3.0 2 To 3.0 3 Python 4.0 有人能提出一些解决办法吗。使

我想将列表转换为数据帧。挑战在于列表中的项目如下所示,我需要将列表中每个项目的字符串值提取到数据帧的一列中

列表看起来像

Keyword = [('Hello',2.0),('Welcome',3.0),('To',3.0),('Python',4.0)]
需要数据帧作为

输出:

     Keyword  Score
0    Hello    2.0
1    Welcome  3.0
2    To       3.0
3    Python    4.0
有人能提出一些解决办法吗。

使用
columns=[“关键字”,“分数”]

Ex:

import pandas as pd
Keyword = [ ('Hello',2.0),('Welcome',3.0),('To',3.0),('Python',4.0)]
df = pd.DataFrame(Keyword, columns=["Keyword", "Score"])
print(df)
   Keyword  Score
0    Hello    2.0
1  Welcome    3.0
2       To    3.0
3   Python    4.0
输出:

import pandas as pd
Keyword = [ ('Hello',2.0),('Welcome',3.0),('To',3.0),('Python',4.0)]
df = pd.DataFrame(Keyword, columns=["Keyword", "Score"])
print(df)
   Keyword  Score
0    Hello    2.0
1  Welcome    3.0
2       To    3.0
3   Python    4.0
使用
columns=[“关键字”,“分数”]

Ex:

import pandas as pd
Keyword = [ ('Hello',2.0),('Welcome',3.0),('To',3.0),('Python',4.0)]
df = pd.DataFrame(Keyword, columns=["Keyword", "Score"])
print(df)
   Keyword  Score
0    Hello    2.0
1  Welcome    3.0
2       To    3.0
3   Python    4.0
输出:

import pandas as pd
Keyword = [ ('Hello',2.0),('Welcome',3.0),('To',3.0),('Python',4.0)]
df = pd.DataFrame(Keyword, columns=["Keyword", "Score"])
print(df)
   Keyword  Score
0    Hello    2.0
1  Welcome    3.0
2       To    3.0
3   Python    4.0
使用,您可以按以下步骤进行操作:

my_dataframe = pd.DataFrame(Keyword, columns=["Keyword", "Score"])
结果如下:

注意:您确实应该考虑使用小写变量名。

使用可以按以下步骤进行:

my_dataframe = pd.DataFrame(Keyword, columns=["Keyword", "Score"])
结果如下:


注意:您真的应该考虑使用小写变量名。

我看不到您这方面有任何工作。我看不到您这方面有任何工作。