0

I have dataframe shaped like this.

     Date          Close        Open        High       Low     Volume   Change Day week Year
0   1999-01-04  1228.1000   1229.2000   1248.8000   1219.1000   0.0000  -0.0009 0   1   1999
1   1999-01-05  1244.8000   1228.1000   1246.1000   1228.1000   0.0000  0.0136  1   1   1999
2   1999-01-06  1272.3000   1244.8000   1272.5000   1244.8000   0.0000  0.0221  2   1   1999
3   1999-01-07  1269.7000   1272.3000   1272.3000   1257.7000   0.0000  -0.0020 3   1   1999
4   1999-01-08  1275.1000   1269.7000   1278.2000   1261.8000   0.0000  0.0043  4   1   1999
                                              *
                                              * 
                                              * 

And I wish to get "Day" value or simply just entire row where "Close" value is the lowest from the week it belongs

I tried to do so by using groupby()

df.groupby(["Year","week"])["Close"].agg("min")

The result shows me the lowest "Close" value of each week.

Year  week
1999  1      1228.1000
      2      1212.2000
      3      1225.2000
      4      1234.0000
      5      1239.4000
            ...   
2022  11     4173.1100
      12     4456.2300
      13     4530.4100
      14     4481.1500
      15     4412.5300

I'm lost after this step and don't know how to get "Day" (or "Date") values together

TAT_
  • 1

0 Answers0