我有一个系列列表:
[0 1.738976
1 1.230319
2 1.238717
3 1.224020
4 1.071875
dtype: float64, 5 1.132621
6 1.116945
7 0.922949
8 1.101268
9 1.065996
dtype: float64, 10 1.020927
11 1.022459
12 1.034100
13 0.995297
14 1.036040
dtype: float64, 15 1.245819
16 1.364338
17 0.989574
18 1.024846
19 0.979776
dtype: float64, 20 1.583318
21 1.561273
22 1.795929
23 1.769475
24 1.757718
dtype: float64, 25 1.040522
26 1.022886
27 0.724544
28 0.718666
29 0.736302
dtype: float64, 30 0.721605
31 0.842607
32 0.827911
33 0.818113
34 2.153058
dtype: float64, 35 2.303698
36 2.402411
37 2.233889
38 3.288128
39 2.579750
dtype: float64]
我想将系列的所有值放在一个列表中。我试过了:
a = [list_of_series]
a1 = reduce(lambda x, y: x+y, a)
但输出是Nan值。
答案 0 :(得分:2)
我认为你需要concat
:
s = pd.concat(L)
L = [s1,s2,s3]
print (L)
[0 1.738976
1 1.230319
2 1.238717
3 1.224020
4 1.071875
Name: val, dtype: float64, 5 1.132621
6 1.116945
7 0.922949
8 1.101268
9 1.065996
Name: val, dtype: float64, 10 1.020927
11 1.022459
12 1.034100
13 0.995297
14 1.036040
Name: val, dtype: float64]
s = pd.concat(L)
print (s)
0 1.738976
1 1.230319
2 1.238717
3 1.224020
4 1.071875
5 1.132621
6 1.116945
7 0.922949
8 1.101268
9 1.065996
10 1.020927
11 1.022459
12 1.034100
13 0.995297
14 1.036040
Name: val, dtype: float64
print ([s])
[0 1.738976
1 1.230319
2 1.238717
3 1.224020
4 1.071875
5 1.132621
6 1.116945
7 0.922949
8 1.101268
9 1.065996
10 1.020927
11 1.022459
12 1.034100
13 0.995297
14 1.036040
Name: val, dtype: float64]