i want to know how can i get the start date, end date and date range covered by data.
user_id gender address store_id trans_id timestamp item_id quantity dollar
0 101981 F E 2860 818463 2000-11-01 4.710000e+12 1 37
1 101981 F E 2861 818464 2000-11-01 4.710000e+12 1 17
2 101981 F E 2862 818465 2000-11-01 4.710000e+12 1 23
3 101981 F E 2863 818466 2000-11-01 4.710000e+12 1 41
4 101981 F E 2864 818467 2000-11-01 4.710000e+12 8 288
# Convert timestamp to pandas datetime object
df['timestamp'] = pd.to_datetime(df['timestamp'])
# Sort dataframe by date
df = df.sort_values(by='timestamp', ascending=False)
# Start date
print(df['timestamp'].min())
# End date
print(df['timestamp'].max())
# Date range is just between minimum and maximum
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.