I created this script:
import pandas as pd pd.set_option('display.min_rows', None) pd.set_option('display.max_columns', None) df = pd.read_excel('file.xlsx', sep=';', skiprows=6) df = df.drop(['Position', 'Swap'], axis=1) df.drop_duplicates(['Time']) df = df.groupby(['Symbol'])[['Profit', 'Volume', 'Commission']].sum() df['Comm. ratio'] = (df['Commission'] / df['Profit']) df['Comm. ratio'] = df['Comm. ratio'].round(2) df['Net profit'] = (df['Profit'] + df['Commission']) df.loc['Total'] = pd.Series(df['Commission'].sum(), index = ['Commission']) Symbol Profit Volume Commission Comm. ratio Net profit BA FB NVDA US500 USTEC Total -45 df.loc['Total'] = pd.Series(df['Commission'].sum(), index = ['Commission'])
works on "commission" column, but I'd like to have a multiple column sum for "Profit, Commission, and Net profit" in the "Total" row.
I couldn't make it work.