Answers for "divide a column dataframe by 12"

0

divide two columns pandas

#If you want to divide column_name1 by column_name2
df['new_column'] = df.column_name1.div(df.column_name2)
Posted by: Guest on August-06-2021
0

how to divide 1 dataframe into two based on elements of 1 column

df = pd.DataFrame({'Sales':[10,20,30,40,50], 'A':[3,4,7,6,1]})
print (df)
   A  Sales
0  3     10
1  4     20
2  7     30
3  6     40
4  1     50

s = 30

df1 = df[df['Sales'] >= s]
print (df1)
   A  Sales
2  7     30
3  6     40
4  1     50

df2 = df[df['Sales'] < s]
print (df2)
   A  Sales
0  3     10
1  4     20
Posted by: Guest on June-16-2021

Code answers related to "divide a column dataframe by 12"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language