1
这是我的系列命名的表转换蟒蛇熊猫系列的数据框和拆分栏分成两个
Host
cds170.yyz.llnw.net 1
cds172.yyz.llnw.net 3
cds180.yyz.llnw.net 1
cds182.yyz.llnw.net 1
cds183.yyz.llnw.net 3
fcds113.yyz.llnw.net 1
Name: Host, dtype: int64
这是我想
Host count
cds170.yyz.llnw.net 1
cds172.yyz.llnw.net 3
cds180.yyz.llnw.net 1
cds182.yyz.llnw.net 1
cds183.yyz.llnw.net 3
fcds113.yyz.llnw.net 1
我已经试过
table = pd.DataFrame(table)
table = pd.DataFrame(table.Host.str.split().tolist(), columns = ['Host', 'count'])
数据帧
但我得到
ValueError: Shape of passed values is (1, 1), indices imply (2, 1)
有人可以帮我做这个吗?
顺便说不要使用Python代码的代码片段工具,因为你不能使用小部件来运行它,所以最好使用光标选择代码,然后按ctrl + k,也可以upvote ;-) – EdChum