How to extract or split some days from date when date is index or string in Python?


I have 6000 rows and 8 columns, where ‘Date’ is like index or I can reset index and it would be like first column with string type. I need to Extract the list of ‘Lake_Level’ values where date of a record is second and seventh day of a month ( and provide top 3 and bottom 3 values of the ‘Lake_Level’ feature). Please show me how to make it. Thank you in advance.

You didn’t indicate the data source or the package you’re using to process the date, thus take this with a grain of salt. Assuming you are using Pandas to read a CSV file, note that the read_csv function has a parameter you can set to a list of column names which represent dates. It will automatically convert those columns’ days to datetime objects. You should be able to write a query pretty easily which selects just the rows matching your constraint.