import pandas as pd mt4_df = pd.read_html(result_path, "#", parse_dates=["Time"], header=0)[0] entry_df = mt4_df[mt4_df["Type"] == "buy" | mt4_df["Type"] == "sell"][["#", "Time", "Type", "Order", "Size", "Price"]] close_df = mt4_df[mt4_df["Type"] != "buy" & mt4_df["Type"] != "sell"][["Time", "Price", "Profit"]] close_df.columns = ["CloseTime","ClosePrice", "Profit"] close_df.index = entry_df.index