我有一个DataFrame
A B C D
2015-07-18 4.534390e+05 2.990611e+05 5.706540e+05 4.554383e+05
2015-07-22 3.991351e+05 2.606576e+05 3.876394e+05 4.019723e+05
2015-08-07 1.085791e+05 8.215599e+04 1.356295e+05 1.096541e+05
2015-08-19 1.397305e+06 8.681048e+05 1.672141e+06 1.403100e+06
...
我只是想将所有列相加以获得新的数据帧
A B C D
sum s s s s
使用列式和,然后使用to_csv()
打印。何时使用
df.sum(axis=0)
print(df)
A 9.099377e+06
B 5.897003e+06
C 1.049932e+07
D 9.208681e+06
dtype: float64
答案 0 :(得分:12)
您可以将1
转换为$("your-form-id or event-any-id").on("click", function(event)
{ event.preventDefault();
var post = new FormData( $("#form-id") );
$.ajax({
url: "url",
type: "POST OR GET",
dataType: "JSON",
data: post,
processData: false,
contentType: false,
success: function (data, status) {},
error: function (xhr, desc, err){}
});
});
并转置它:
df.sum()
答案 1 :(得分:4)
pd.DataFrame
的略短版本(由于简化而归功于jezrael):
In [120]: pd.DataFrame([df.sum()], index=['sum'])
Out[120]:
A B C D
sum 2358458.2 1509979.49 2766063.9 2370164.7
答案 2 :(得分:3)
使用<div class="container">
<div class="single_tag">First div
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<div class="single_tag">Second div
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<div class="single_tag">Third div
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
构造函数:
DataFrame
答案 3 :(得分:0)
我认为最简单的是df.agg([sum])
df.agg([sum])
Out[40]:
A B C D
sum 2358458.2 1509979.49 2766063.9 2370164.7