I have the code below in my juniper book. If user_payments is empty, i have message "no information" back. it works fine. But if rent_id is not empty, the information about user_profile (which must be printed inside of if: block, is not visible. If I add printing user_profile after if-else block and information is exist - it shows correctly.
if not user_payments.loc[:,'powerBankRentId'].empty:
rent_id = user_payments.loc[:,'powerBankRentId'].values[0]
user_profile['rent_id'] = rent_id
user_last_rent = table_rents[table_rents['id'] == rent_id]
user_profile.append(table_rents[table_rents['id'] == rent_id].loc[:,['station_name','createdAt','endAt']])
user_profile['station_name'] = user_last_rent.loc[:,'station_name'].values[0]
user_profile['start_rent'] = user_last_rent.loc[:,'createdAt'].values[0]
user_profile['end_rent'] = user_last_rent.loc[:,'endAt'].values[0]
user_profile # doesn't print anything
else:
print('no information')
Can you give me an idea how i mush correct the code?
as it is one row dataframe, i wrote:
and got expected