数量1数量2数量3数量4数量5数量6数量7数量8数量9数量10数量11数量12数量13数量14数量15数量16数量17数量18数量19数量20 REV价格 28 39 41 44 33 33 44 36 41 46 29 34 35 31 28 38 31 36 45 30 250 25
我在熊猫数据框中只有一个22列 我想用“ mean_val”将所有以“ QTY”开头的列进行划分,这等效于25.3654 该怎么做?
答案 0 :(得分:1)
您可以执行此操作,假设您的数据帧位于变量df中:
let input = document.getElementById("ModelNo").value;
if(input.includes(Model_1)){/* do something*/}
else (input.includes(Model_2)){/* do something else*/}
答案 1 :(得分:0)
import pandas as pd
# Sample data frame defined as per your requirement and the mean value.
data = { 'qty 1': [23] , 'qty 2': [26], 'price': [25], 'rate': [250]}
df = pd.DataFrame(data=data, index=None)
mean_value = 25.3654
# Using dataframe's update() and filter() functions to achieve the outcome
df.update(df.filter(regex='qty.*') / mean_value)
print(df)