I have a dataframe from a csv which contains information about Covid-19 by date and the amount of cases,deaths,recovered on that date. I need to find the date when the first case and death occurs. Im trying data.groupby(['Cases',]).agg({'Date': [np.min]})
but this gives me all the amount of cases and their corresponding date when it first happens (as you can see below) when I only need when the first case occurs not counting 0 obviously. Thanks!
Edit: Got the first part now there is another column which is states, how do I get the first case of each state?
Date
amin
Cases
0 2020-02-20
1 2020-02-20
2 2020-02-24
3 2020-02-27
4 2020-02-26
... ...
34188 2020-04-02
36249 2020-04-03
37584 2020-04-04
38723 2020-04-05
40469 2020-04-06