Assignment07
Assignment07
Gorakhpur
Day-07:
df = pd.DataFrame({'X':[78,85,96,80,86], 'Y':[84,94,89,83,86],'Z':[86,97,96,72,83]});
print(df)
Ans: X Y Z
0 78 84 86
1 85 94 97
2 96 89 96
3 80 83 72
4 86 86 83
import pandas as pd
data1 = {
df1 = pd.DataFrame(data1)
print(df1)
df1["Total_Sales"] = df1["Sales"]
print(df1)
data2 = {
df2 = pd.DataFrame(data2)
print(df2)
print("\nConcatenated DataFrame:")
print(df_combined)
print(sales_7_8)
print(shampoo_sales)
total_sales = df_combined["Total_Sales"].sum()
df.sum(axis=1)
df.max(axis=1)
3. Show the sales data of “Vikas” for all the months [ df.loc[4 ]) ]
df.loc[4]
4. Show the Sales data of all the sales person for the month of APR. [ df[‘Apr’]] 5.
Show the sales data of FEB and JUN for the entire sales person. [df[ [‘Feb’, ‘Jun’
]]
df['Apr']
6. Show the sales data of “Ajit” for the month of Apr, May, Jun.
[ n=df.loc[ 3]
n[ [‘Apr’,’May’,’Jun’] ] ]
n = df.loc[3]
n[['Apr', 'May', 'Jun']]
7. Find average sales of each sales person. [ df.mean(axis=1) ]
df.mean(axis=1)
df.min(axis=1)
df.min(axis=0)
df.median(axis=1)
df.median(axis=0)