+ 1
Data Science - Missing Numbers
Hello! I'm doing the Data Science - Missing Numbers task and I have done a code but the system doesn't recognize the answer of the code... Can someone help me? My code: import numpy as np lst = [float(x) if x != 'nan' else np.NaN for x in input().split()] arr = np.array(lst) arr1 = np.nan_to_num(arr, nan=np.round(np.nanmean(arr), decimals = 1)) count = 0 for i in arr1: #np.round(np.nanmean(arr), decimals = 1) count += 1 print(count - 1, i)
3 Réponses
+ 3
import numpy as np
import pandas as pd
lst = [float(x) if x != 'nan' else np.NaN for x in input().split()]
lst_df = pd.Series(lst)
abdullah = lst_df.fillna(lst_df.mean()).round(1)
print(abdullah)
+ 1
Copy this answer and like and check thanks