let me rephrase my question:
I have the following dataset:
data = {
'globalId': {0: 4388064, 1: 4388200, 2: 4399344, 3: 4400638, 4: 4401765, 5: 4401831},
'publicatieDatum': {0: '2018-07-31', 1: '2018-09-24', 2: '2018-08-02', 3: '2018-08-04', 4: '2018-08-05', 5: '2018-08-06'},
'postcode': {0: '1774PG', 1: '7481LK', 2: '1068MS', 3: '5628EN', 4: '7731TV', 5: '5971CR'},
'koopPrijs': {0: 139000.0, 1: 209000.0, 2: 267500.0, 3: 349000.0, 4: 495000.0, 5: 162500.0}
}
df = pd.DataFrame(data)
print(df)
This is the code for the municipality name of the zipcode/postal code of the 1st row:
nomi.query_postal_code(["1774"])
Now, I want to add a column called 'Gemeente'.
This can be retreived using the following formule:
>>> nomi.query_postal_code(["postcode"])
The postcode above should indicate the 4 numbers of the postcode within the postcode column.
I have 2 questions:
How can i add a code that calculates the gemeente for all rows in the above dataframe, based on the 'postcode', as specified above.
How can this code be written that it only selects the first 4 digits in the postcode column.
Apologies and thanks!