Python 3.x 如何使用数学';python中的s Mod函数Ex:-|-x |=x
我有一个包含一些数据的数据框Python 3.x 如何使用数学';python中的s Mod函数Ex:-|-x |=x,python-3.x,pandas,function,math,Python 3.x,Pandas,Function,Math,我有一个包含一些数据的数据框 import pandas as pd start = time.time() data_store = pd.read_excel("101010.xlsx") print(data_store) A B 100 -200 100 -99 200 -150 100
import pandas as pd
start = time.time()
data_store = pd.read_excel("101010.xlsx")
print(data_store)
A B
100 -200
100 -99
200 -150
100 150
50 -60
70 50
80 -100
25 15
30 40
50 -25
我想在python数据帧中应用Math的Mod函数并打印结果
例:--200 |=200
请大家帮助我如何在python数据框架中应用这个函数
提前感谢:):)- python:3.8.5
- 熊猫:1.1.1
- xlrd:1.2.0
你认为绝对值吗<代码>df.B.abs()?还是模?样本数据的预期输出是什么?
import pandas as pd
data_store = pd.read_excel('101010.xlsx')
data_store.B = data_store.B.abs() # Absoulte value of Column B
print(data_store)
A B
0 100 200
1 100 99
2 200 150
3 100 150
4 50 60
5 70 50
6 80 100
7 25 15
8 30 40
9 50 25