'TypeError: '>=' not supported between instances of 'str' and 'datetime.datetime' [duplicate]

I am facing this error:

data[(data['Timestamp'] >= datetime(2018, 4 , 1, tzinfo=utc)) & (data['Timestamp'] <= datetime(2022, 4, 1, tzinfo=utc))]



Solution 1:[1]

I got my error and finally solved

import pandas
from pytz import utc
from datetime import datetime

data = pandas.read_csv("reviews.csv", parse_dates=["Timestamp"])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abdullah Niaz