如何使用 python spider IDE 从 csv 文件中查找每一行的 rms 值?
How to find rms value of every row from a csv file using python spider IDE?
我写了这段读取csv文件的代码
import numpy as np
import pandas as pd
ratings_data = pd.read_csv("matrix1.csv")
ratings_data.head()
现在我想要每一行的均方根值。有什么办法吗?
rms 表示均方根。
直到有人或我想出一个 built-in/one 衬里:
import math
import pandas as pd
ratings_data = pd.read_csv("matrix1.csv")
for index, row in ratings_data.iterrows():
print(
math.sqrt(
((ratings_data['col_a'] ** 2) + (ratings_data['col_b'] ** 2) +
(ratings_data['col_c'] ** 2))/3
)
)
我写了这段读取csv文件的代码
import numpy as np
import pandas as pd
ratings_data = pd.read_csv("matrix1.csv")
ratings_data.head()
现在我想要每一行的均方根值。有什么办法吗? rms 表示均方根。
直到有人或我想出一个 built-in/one 衬里:
import math
import pandas as pd
ratings_data = pd.read_csv("matrix1.csv")
for index, row in ratings_data.iterrows():
print(
math.sqrt(
((ratings_data['col_a'] ** 2) + (ratings_data['col_b'] ** 2) +
(ratings_data['col_c'] ** 2))/3
)
)