+ 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)

2nd Feb 2021, 9:13 PM
Victor Resende
Victor Resende - avatar
3 ответов
+ 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)
14th Sep 2021, 7:44 AM
Brigido bergado jr
Brigido bergado jr - avatar
+ 1
Copy this answer and like and check thanks
14th Sep 2021, 7:44 AM
Brigido bergado jr
Brigido bergado jr - avatar