Date, 1, 2, 3, 4
2010-02-04, 213.429998, 214.499996, 212.38000099999996, 214.009998,
2010-03-05, 214.599998, 215.589994, 213.249994, 214.379993
2010-04-06, 214.379993, 215.23, 210.750004, 210.969995
2010-05-07, 211.75, 212.000006, 209.050005, 210.58
2010-06-08, 210.299994, 212.000006, 209.06000500000002, 211.98000499999998
import io
import pandas as pd
data = cvs_data = io.StringIO('''Date, 1, 2, 3, 4
2010-02-04, 213.429998, 214.499996, 212.38000099999996, 214.009998
2010-03-05, 214.599998, 215.589994, 213.249994, 214.379993
2010-04-06, 214.379993, 215.23, 210.750004, 210.969995
2010-05-07, 211.75, 212.000006, 209.050005, 210.58
2010-06-08, 210.299994, 212.000006, 209.06000500000002, 211.98000499999998''')
df = pd.read_csv(data, sep=",")
df['Date'] = pd.to_datetime(df.Date)
print(df[df['Date'] > datetime.datetime(2010, 5, 1)])
Date 1 2 3 4
3 2010-05-07 211.750000 212.000006 209.050005 210.580000
4 2010-06-08 210.299994 212.000006 209.060005 211.980005
Python 3.9.13 (main, Jul 5 2022, 16:17:50)
[GCC 12.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> s="""Date, 1, 2, 3, 4
... 2010-02-04, 213.429998, 214.499996, 212.38000099999996, 214.009998,
... 2010-03-05, 214.599998, 215.589994, 213.249994, 214.379993
... 2010-04-06, 214.379993, 215.23, 210.750004, 210.969995
... 2010-05-07, 211.75, 212.000006, 209.050005, 210.58
... 2010-06-08, 210.299994, 212.000006, 209.06000500000002, 211.98000499999998"""
>>> data=[line.split(',') for line in s.split('\n')]
>>> sorted(data[1:], key=lambda m: m[0], reverse=True)
[['2010-06-08', ' 210.299994', ' 212.000006', ' 209.06000500000002', ' 211.98000499999998'], ['2010-05-07', ' 211.75', ' 212.000006', ' 209.050005', ' 210.58'], ['2010-04-06', ' 214.379993', ' 215.23', ' 210.750004', ' 210.969995'], ['2010-03-05', ' 214.599998', ' 215.589994', ' 213.249994', ' 214.379993'], ['2010-02-04', ' 213.429998', ' 214.499996', ' 212.38000099999996', ' 214.009998', '']]
>>>