0

This dataframe appears to have correct maximum values, yet the COVID 19 project indicates that the solution is incorrect.

https://code.sololearn.com/cuwbhiC705kB/?ref=app

17th Oct 2022, 3:24 AM
Sanjay Kamath
Sanjay Kamath - avatar
10 odpowiedzi
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))
17th Oct 2022, 8:35 AM
Bob_Li
Bob_Li - avatar
+ 2
Bob_Li Incredibly a direct copy paste worked 🐸 Bravo 🙏🏾
18th Oct 2022, 1:15 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 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.
17th Oct 2022, 4:16 AM
Bob_Li
Bob_Li - avatar
+ 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.🤔
17th Oct 2022, 8:38 AM
Bob_Li
Bob_Li - avatar
+ 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.
17th Oct 2022, 12:28 PM
Sanjay Kamath
Sanjay Kamath - avatar
0
Bob_Li Sir, take a peek at this revised code...seems okay but results indicate otherwise... https://code.sololearn.com/cGI6e30Mu9xe/?ref=app
17th Oct 2022, 8:06 AM
Sanjay Kamath
Sanjay Kamath - avatar
0
Bob_Li It is not state but ratio. Still no correct answer.
17th Oct 2022, 12:29 PM
Sanjay Kamath
Sanjay Kamath - avatar
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...😲
17th Oct 2022, 1:22 PM
Bob_Li
Bob_Li - avatar
0
Bob_Li refer Python COVID 2020 problem. So far no edit works.
17th Oct 2022, 3:31 PM
Sanjay Kamath
Sanjay Kamath - avatar
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.
17th Oct 2022, 3:46 PM
Bob_Li
Bob_Li - avatar