0
This dataframe appears to have correct maximum values, yet the COVID 19 project indicates that the solution is incorrect.
10 Antworten
0
import pandas as pd
data = pd.read_csv("/usercode/files/ca-covid.csv")
df = pd.DataFrame(data)
df = df.assign(ratio = df.deaths/df.cases)
result = (df.sort_values(by=['ratio'],ascending=False))
del result ["state"]
result.set_index("date", inplace=True)
print (result.head(1))
+ 2
Bob_Li Incredibly a direct copy paste worked 🐸 Bravo 🙏🏾
+ 1
the output should be a dataframe...
The code coach also seems questionable...I had to drop the 'state' column in order to pass, but it was not explicitly stated in the problem.
+ 1
The problem said vaguely to index by date.
The delete 'state' I found out only by trial and error.
It also took me a long time to figure out.
"Important: The output should be a DataFrame, containing all of the columns of the dataset for the corresponding row."
all of the columns... so why do I have to delete ['state'] to pass? makes no sense.❓
Anyway, the code above and the one I posted in the comment in your code works.
So, it was not a very clearly stated problem.🤔
+ 1
Bob_Li This seems to be an example of scope creep.
1.Dataframe output-specified
2.Ratio specified
3.Removal of ratio column NOT SPECIFIED.
4.Rearrangement - NOT INDICATED
In other words,
This is a poorly defined problem,and, should be indicated as such.
0
Bob_Li Sir, take a peek at this revised code...seems okay but results indicate otherwise...
https://code.sololearn.com/cGI6e30Mu9xe/?ref=app
0
Bob_Li It is not state but ratio. Still no correct answer.
0
i tried both codes and they passed. Did you try the one I wrote your code comment?
removal of state column, not ratio column., I tried it both ways...
now I'm confused...😲
0
🤔🤔🤔very strange..
The codes I gave you passes.
Try a direct copy paste.
Or maybe one of our. Sololearn app was not updated? Or there'a a difference in the app and web version? I'm on the app.