这是我写的以熊猫开头的非常简单的代码。
import pandas
lst = [1,2,3,1,2,3]
lst2 = [5,6,7,5,6,7]
lst3 = [1,2,3,10,20,30]
s = pandas.Series(lst,lst2,lst3)
输出给出错误:datatype not understood
。
为什么会这样,我该如何解决?
答案 0 :(得分:1)
使用 numpy 连接。如果数字需要唯一,请使用 set
<body>
<div class="content">
<div class="panel">
<div class="description">
<h1>I dream about this girl everyday, but cannot seem to forget her.</h1>
<p>People say not many people can fall in love, and it's good I can experience it, but what is unrequited love worth actually.</p>
</div>
</div>
<div class="panel">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/original-image.jpg" alt="Original">
</div>
<div class="panel">
<div class="description">
<h1>My name is John Snow.</h1>
<p>I like making popcorn with icicles alot.</p>
</div>
</div>
</div>
<div class="handle"></div>
</div>
</body>
输出:
lst = [1,2,3,1,2,3]
lst2 = [5,6,7,5,6,7]
lst3 = [1,2,3,10,20,30]
result=np.concatenate([lst,lst2,lst3],axis=0)
print(result)
答案 1 :(得分:0)
创建熊猫系列对象的最简单方法是在尝试时使用列表:
import pandas as pd
lst = [1,2,3,1,2,3]
lst2 = [5,6,7,5,6,7]
lst3 = [1,2,3,10,20,30]
#But pandas series object accept only one argument for data. there are others like #index,name, etc
pd.Series(lst + lst2 + lst3)
#creates a series
0 1
1 2
2 3
3 1
4 2
5 3
6 5
7 6
8 7
9 5
10 6
11 7
12 1
13 2
14 3
15 10
16 20
17 30