Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
197 views
in Technique[技术] by (71.8m points)

python - Multiply two values from different pandas dataframes

Hi I try to multiply two values from different dataframes. Dataframes are difrent size to.

ox_data = [['SiO2', 60.06],
           ['Al2O3', 101.96],
           ['TiO', 79.866],
           ['Fe2O3', 159.69],
           ['Na2O', 61.99],
           ['CO2', 0]]
QC_data = [['Piasek szkl kl. 1', ox_data[0][0], 0.996],
           ['Piasek szkl kl. 1', ox_data[1][0], 0.0012],
           ['Piasek szkl kl. 1', ox_data[2][0], 0.0003],
           ['Piasek szkl kl. 1', ox_data[3][0], 0.000108]]

gp = [['Piasek szkl kl. 1', 150], ['Soda', 45]]


ox = DataFrame(ox_data, columns=['Oxide', 'Molar_mass'])
rawmat_compound = DataFrame(QC_data, columns=[
   'Raw_Material', 'Oxide', 'Prc_Quantity'])
glass_compound = DataFrame(gp, columns=['Raw_Material', 'Quantity'])


ox_compound = DataFrame()
ox_compound['Oxide'] = ox['Oxide']
ox_compound['quantity_kg'] = np.zeros(17)
ox_compound['prc_quantity'] = np.zeros(17)

I want to multiply Quantity from glass_compound by Prc_Quantity from rawmat_compound and place the sum value for every oxide in new table ox_compound.

question from:https://stackoverflow.com/questions/66047242/multiply-two-values-from-different-pandas-dataframes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...