import matplotlib matplotlib.use('Agg') import os os.chdir(f'{os.getcwd()}/EDA_Agent') import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv('df.csv') df.groupby('Sex')['Survived'].mean().plot(kind='bar', rot=0) plt.ylabel('Survival Rate') plt.xlabel('Gender') plt.title('Survival Rate by Gender') plt.savefig('graphs/survival_rate_by_gender.png')