I'm trying to find where nans are in this column, change it to a different value and update the dataset. I was able to access the nan by using [0][0] for this example but this solution will not work if I don't know where the nans are. I'm hoping someone can suggest how can we dynamically search for nans and change them when they happen to be in array of arrays.
def check_for_nan():
data = {'numbers': [[np.nan], [11, 14], [45, 56], [67, 88], [99]]}
df = pd.DataFrame(data=data)
df["numbers"][0][0] = 40
print(df["numbers"])
Desired Output:
0 [40]
1 [11, 14]
2 [45, 56]
3 [67, 88]
4 [99]
Name: numbers, dtype: object