Module 4 Assignment: Analyzing Car CO₂ Emissions

this code is generating error. can someone help me correct this code please? # 1. Filter the data
compact = df[df[‘Vehicle class’] == ‘Compact’]
mid_size = df[df[‘Vehicle class’] == ‘Mid-size’]

2. Perform the two-sample t-test (Welch’s)

t_stat, p_value = stats.ttest_ind(
compact[‘CO2 emissions’],
mid_size[‘CO2 emissions’],
equal_var=False,
alternative=‘two-sided’ # adjust to ‘greater’ or ‘less’ if needed
)

Hi @Dut_Manut_Ayiei_Dut

The issue with your code is due to the use of invalid quotation marks ( and ) (a bit curved shape) instead of regular Python string quotes (' or ") (straight lines).

Hope it helps!