当前位置:网站首页>How does dataframe calculate the average value of each row as another column
How does dataframe calculate the average value of each row as another column
2022-07-04 07:27:00 【Just want to be a migrant worker】
You can use the following code to calculate .
df['Col_sum'] = df.apply(lambda x: x.sum(), axis=1)
In addition, how to calculate the average value of each column as another row
df.loc['Row_sum'] = df.apply(lambda x: x.sum())
Of course , This method can be used to calculate variance and other statistical data , For example, to calculate variance, just replace it with x.std() That's it .
边栏推荐
- win10微软拼音输入法输入文字时候下方不出现中文提示
- [C language] open the door of C
- [thread pool]
- flask-sqlalchemy 循环引用
- The idea of implementing charts chart view in all swiftui versions (1.0-4.0) was born
- Take you to master the formatter of visual studio code
- Cell reports: Wei Fuwen group of the Institute of zoology, Chinese Academy of Sciences analyzes the function of seasonal changes in the intestinal flora of giant pandas
- Zephyr 学习笔记2,Scheduling
- Introduction to spark core components
- Master-slave replication principle of MySQL database
猜你喜欢
【Kubernetes系列】Kubernetes 上安装 KubeSphere
Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction
Blog stop statement
the input device is not a TTY. If you are using mintty, try prefixing the command with ‘winpty‘
Introduction to spark core components
手写简易版flexible.js以及源码分析
socket inet_ pton() inet_ Ntop() function (a new network address translation function, which converts the expression format and numerical format to each other. The old ones are inet_aton(), INET_ ntoa
flask-sqlalchemy 循环引用
Four sets of APIs for queues
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
随机推荐
jdbc连接es查询的时候,有遇到下面这种情况的大神嘛?
Would you like to go? Go! Don't hesitate if you like it
Directory of tornado
Implementation of ZABBIX agent active mode
Blue Bridge Cup Quick sort (code completion)
Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
Status of the thread
2022-021ARTS:下半年開始
【森城市】GIS数据漫谈(一)
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
Xcode 14之大变化详细介绍
Campus network problems
Introduction to spark core components
The number of patent applications in China has again surpassed that of the United States and Japan, ranking first in the world for 11 consecutive years
[C language] open the door of C
When JDBC connects to es query, is there a God who meets the following situation?
Introduction to deep learning Ann neural network parameter optimization problem (SGD, momentum, adagrad, rmsprop, Adam)
Set JTAG fuc invalid to normal IO port
电子协会 C语言 1级 35 、银行利息
节点基础~节点操作