I only want the times that have nan beside them to be stored and printed, without the nan part. currently the output is this.
Id just like it so it prints 8:00, 15:00, 16:00, 17:00 for each day
my code is
free_times = {}
free_times.update(df3.drop_duplicates())
for key2 in free_times.values():
print(key2)
CodePudding user response:
free_times.values()
returns the values from the dictionary, not the keys. Use .items()
to get both the keys and values, so you can check if it's nan
.
from math import isnan
for key2, value2 in free_times.items():
if isnan(value2):
print(key2)