indexS = 0
indexE = 0
rNumS = 0
rNumE = 0
for i, row in dfPeople.iterrows():
cityS = "null"
stateS = "null"
cityE = "null"
stateE = "null"
if (dfPeople.at[i,'CityP'] == 1):
rNumS = dfSaferCities.iloc[indexS]['RelocationNumber']
if (rNumS == 0):
indexS += 1
cityS = dfSaferCities.iloc[indexS]['Name']
stateS = dfSaferCities.iloc[indexS]['State']
dfPeople.at[i,'CityChosen'] = cityS
dfPeople.at[i,'StateOfCityChosen'] = stateS
rNumS -= 1
if (dfPeople.at[i,'CityP'] == 2):
rNumE = dfEconomicalCities.iloc[indexE['RelocationNumber']
if (rNumE == 0):
indexE += 1
cityE = dfEconomicalCities.iloc[indexE]['Name']
stateE = dfEconomicalCities.iloc[indexE]['State']
dfPeople.at[i,'CityChosen'] = cityE
dfPeople.at[i,'StateOfCityChosen'] = stateE
rNumE -= 1
I get an invalid syntax error on "if (rNumE == 0):" and I do not know why. It looks correct to me. I don't know what else to say. I really really do not know what else it could be.
Aucun commentaire:
Enregistrer un commentaire