I solved this project and got the outputs well but it wont stop showing a zero on top of my output and it wasn't approved... Any help??? This is the code below.... import numpy as np import pandas as pd lst = [float(x) if x != 'nan' else np.NaN for x in input().split()] list = [num for num in lst if num==float(num)] mean = round(np.mean(list), 1) df = pd.DataFrame(lst) df1 = df.fillna(value=mean) print(df1)
12/30/2020 10:29:37 AMprince taoheed tesla
8 AnswersNew Answer
I've solved the question last week... I somehow figured it out.
while the question asks to convert the input to dataframe, don't do it. think of alternates that will not print column name. i just solved it.
I try to call print(df), but still no success. It seems like this project was made for some old version of pandas
Managed to solve it)) First snippet of code form here helps a lot: https://pandas.pydata.org/pandas-docs/stable/user_guide/10min.html#object-creation
The top 0 is a column name, its like Excel, very similar to Excel. Since you did not make a column name, a 0 is in its place. You have options, Pandas is very flexible. I dont know what your output should be, but take a look at some options you have... https://code.sololearn.com/c9BKQqJUgIqY/?ref=app
Here is my Code On "Missing Numbers" Code coach Using python n=int((input())) l= m=" " for i in range(n): g=int(input()) l.append(g) s=l g=l[n-1] for i in range(s,g,1): if(i in l): continue else: m=m+str(i)+" " print(m) #created by pardhu:)
listed =  for i in range(int(input())): listed.append(int(input())) full = list(range(listed,listed[-1])) diff = set(full) ^ set(listed) print(*list(diff)[:-1])
import numpy as np import pandas as pd last = [float(x) if x != 'nan' else np.NaN for x in input().split()] tota=np.array(last) avg=(pd.Series(last)).mean().round(1) tota=np.nan_to_num(tota , nan=avg) print(pd.Series (tota))