当前位置:网站首页>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 .
边栏推荐
- What is the use of cloud redis? How to use cloud redis?
- Book list | as the technical support Party of the Winter Olympics, Alibaba cloud's technology is written in these books!
- What are the work contents of operation and maintenance engineers? Can you list it in detail?
- 电子协会 C语言 1级 35 、银行利息
- Amd RX 7000 Series graphics card product line exposure: two generations of core and process mix and match
- Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
- rapidjson读写json文件
- The difference between synchronized and lock
- 《剑指Offer》第2版——力扣刷题
- Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
猜你喜欢
NLP literature reading summary
window上用.bat文件启动项目
the input device is not a TTY. If you are using mintty, try prefixing the command with ‘winpty‘
A new understanding of how to encrypt industrial computers: host reinforcement application
User login function: simple but difficult
What are the work contents of operation and maintenance engineers? Can you list it in detail?
Zephyr 學習筆記2,Scheduling
果果带你写链表,小学生看了都说好
Unity opens the explorer from the inspector interface, selects and records the file path
Technical experts from large factories: common thinking models in architecture design
随机推荐
Selenium ide plug-in download, installation and use tutorial
A real penetration test
Node connection MySQL access denied for user 'root' @ 'localhost' (using password: yes
【Kubernetes系列】Kubernetes 上安装 KubeSphere
大学阶段总结
大厂技术专家:架构设计中常用的思维模型
Life planning (flag)
Would you like to go? Go! Don't hesitate if you like it
[Valentine's day] - you can change your love and write down your lover's name
两年前美国芯片扭捏着不卖芯片,如今芯片堆积如山祈求中国帮忙
[kubernetes series] kubesphere is installed on kubernetes
Centos8 install mysql 7 unable to start up
How to share the source code anti disclosure scheme
[Mori city] random talk on GIS data (I)
win10微软拼音输入法输入文字时候下方不出现中文提示
Vulhub vulnerability recurrence 76_ XXL-JOB
[Android reverse] function interception (use cache_flush system function to refresh CPU cache | refresh CPU cache disadvantages | recommended time for function interception)
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
Directory of tornado
【森城市】GIS数据漫谈(一)