当前位置:网站首页>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 .
边栏推荐
- University stage summary
- Zephyr Learning note 2, Scheduling
- It's healthy to drink medicinal wine like this. Are you drinking it right
- The crackdown on Huawei prompted made in China to join forces to fight back, and another enterprise announced to invest 100 billion in R & D
- Introduction to spark core components
- win10微软拼音输入法输入文字时候下方不出现中文提示
- Electronic Association C language level 1 35, bank interest
- [FreeRTOS] FreeRTOS learning notes (7) - handwritten FreeRTOS two-way linked list / source code analysis
- [C language] open the door of C
- One of the general document service practice series
猜你喜欢

Introduction to spark core components

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

云Redis 有什么用? 云redis怎么用?

MySQL中的文本处理函数整理,收藏速查

University stage summary

Crawler (III) crawling house prices in Tianjin

flask-sqlalchemy 循环引用

What is industrial computer encryption and how to do it

Go learning notes - constants

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
随机推荐
Status of the thread
Knowledge payment applet dream vending machine V2
What are the work contents of operation and maintenance engineers? Can you list it in detail?
Introduction to deep learning Ann neural network parameter optimization problem (SGD, momentum, adagrad, rmsprop, Adam)
云Redis 有什么用? 云redis怎么用?
NLP-文献阅读总结
System architecture design of circle of friends
"Sword finger offer" 2nd Edition - force button brush question
Finishing (III) - Exercise 2
com. alibaba. nacos. api. exception. NacosException
Summary of MySQL common judgment functions!! Have you used it
Solution of running crash caused by node error
电脑通过Putty远程连接树莓派
Experience installing VMware esxi 6.7 under VMware Workstation 16
Two years ago, the United States was reluctant to sell chips, but now there are mountains of chips begging China for help
提升复杂场景三维重建精度 | 基于PaddleSeg分割无人机遥感影像
Su Weijie, a member of Qingyuan Association and an assistant professor at the University of Pennsylvania, won the first Siam Youth Award for data science, focusing on privacy data protection, etc
BibTex中参考文献种类
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
[kubernetes series] kubesphere is installed on kubernetes