+ 5

Missing numbers

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)

30th Dec 2020, 10:29 AM
prince taoheed tesla
prince taoheed tesla - avatar
8 Answers
+ 2
I've solved the question last week... I somehow figured it out.
2nd Jan 2021, 9:06 PM
prince taoheed tesla
prince taoheed tesla - avatar
+ 2
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.
10th Apr 2021, 2:57 PM
srikanth murthi
srikanth murthi - avatar
+ 1
I try to call print(df[0]), but still no success. It seems like this project was made for some old version of pandas
2nd Jan 2021, 4:03 PM
Slava Z
+ 1
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
3rd Jan 2021, 2:00 AM
Slava Z
+ 1
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[0] 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:)
29th May 2021, 7:53 PM
𝑷𝒂𝒓𝒅𝒉𝒖_𝑨𝒍𝒂𝒑𝒂𝒕𝒊`
𝑷𝒂𝒓𝒅𝒉𝒖_𝑨𝒍𝒂𝒑𝒂𝒕𝒊` - avatar
0
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
30th Dec 2020, 12:34 PM
Steven M
Steven M - avatar
0
listed = [] for i in range(int(input())): listed.append(int(input())) full = list(range(listed[0],listed[-1])) diff = set(full) ^ set(listed) print(*list(diff)[:-1])
13th Dec 2021, 8:19 AM
Mateo González Bufi
Mateo González Bufi - avatar
0
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))
31st May 2022, 9:49 AM
Olorunsogo Abiodun Isaac
Olorunsogo Abiodun Isaac - avatar