How to find the average and median values of the column 'Total Traded Quantity' for each of the types of 'Trend' df_trend = df.groupby(["Trend"])
average_trades = df_trend["Total Traded Quantity"].mean()
print("The average traded quantity is: ", average_trades)

&gt;&gt;The average traded quantity is:  Trend
Slight or No Change    1.635627e+06
Name: Total Traded Quantity, dtype: float64


But I have 9 types of trends in Trend column, although I get only one type here in the output. How shall I proceed?
df.groupby(df.Trend).mean()['Total Traded Quantity']
df.groupby(df.Trend).median()['Total Traded Quantity']


or

df_trend_average = df.groupby(df.Trend).mean()
df_trend_median = df.groupby(df.Trend).median()