当前位置:网站首页>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 .
边栏推荐
- Finishing (III) - Exercise 2
- Experience installing VMware esxi 6.7 under VMware Workstation 16
- Master-slave replication principle of MySQL database
- Status of the thread
- 2022-021ARTS:下半年开始
- Pangu open source: multi support and promotion, the wave of chip industry
- jdbc连接es查询的时候,有遇到下面这种情况的大神嘛?
- 电子协会 C语言 1级 35 、银行利息
- Chapter 1 programming problems
- System architecture design of circle of friends
猜你喜欢

Two years ago, the United States was reluctant to sell chips, but now there are mountains of chips begging China for help

How to share the source code anti disclosure scheme

Book list | as the technical support Party of the Winter Olympics, Alibaba cloud's technology is written in these books!

Implementation of ZABBIX agent active mode

Zephyr 学习笔记2,Scheduling

手写简易版flexible.js以及源码分析

NLP-文献阅读总结

Amd RX 7000 Series graphics card product line exposure: two generations of core and process mix and match

Splicing plain text into JSON strings - easy language method

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
随机推荐
What is industrial computer encryption and how to do it
Crawler (III) crawling house prices in Tianjin
Zephyr Learning note 2, Scheduling
电子协会 C语言 1级 35 、银行利息
果果带你写链表,小学生看了都说好
Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
Amd RX 7000 Series graphics card product line exposure: two generations of core and process mix and match
Chapter 1 programming problems
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
Zephyr learning notes 1, threads
[web security] nodejs prototype chain pollution analysis
用于压缩视频感知增强的多目标网络自适应时空融合
Novel website program source code that can be automatically collected
大厂技术专家:架构设计中常用的思维模型
Splicing plain text into JSON strings - easy language method
[FreeRTOS] FreeRTOS learning notes (7) - handwritten FreeRTOS two-way linked list / source code analysis
Boast about Devops
Chain ide -- the infrastructure of the metauniverse
Industrial computer anti-virus
notepad++如何统计单词数量