This is possibly the worst way to use `pandas` for this application. A

A `DataFrame` is not a list, it has a certain structure to optimise it for vector operations to avoid looping.

What you're doing, is looping through each entry of a `pandas.Series` (from `df[ 'Country' ]`), storing the market in a separate list and then adding it back into the `DataFrame`.

The `pandas` way to do it is something like this:

```
if df['Country'] == 'Germany': df['Market'] = 'DACH'
```

Then repeat for the rest of the parameters. There are neater ways to write this but you get the idea.

Data Scientist and Chartered Aeronautical Engineer (MEng CEng EUR ING MRAeS) with over 15 years experience in the Aerospace, Defence and Rail Industry.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ashraf Miah

Data Scientist and Chartered Aeronautical Engineer (MEng CEng EUR ING MRAeS) with over 15 years experience in the Aerospace, Defence and Rail Industry.