Code:
# Import cars data
import pandas as pd
cars = pd.read_csv('cars.csv', index_col = 0)
# Adapt for loop
for lab, row in cars.iterrows() :
print(f"{[lab]}: {row['cars_per_cap']}")
Output:
['US']: 809
['AUS']: 731
['JPN']: 588
['IN']: 18
['RU']: 200
['MOR']: 70
['EG']: 45
The output I’m getting is fine but how can I remove brackets and the commas around the country names pls help I ayone knows.
I tried the doubling the brackets around the ‘lab’ but it did’nt worked.