0

I am not getting the desired result on applying the max() and min() function for dates.

Note: I have imported the files through pandas.Below is the data.

sample.csv--->

Trans_no    id  last_Transaction    amount
1   48280   8/15/2016   0
2   281301  6/11/2017   0
3   369080  5/17/2017   0
4   1722942 1/30/2018   60
5   2142311 1/31/2018   20
6   977001  1/31/2018   125
7   1004805 1/13/2018   100
8   401750  3/18/2017   0
9   1004805 2/17/2018   40
10  1722942 2/28/2018   56
11  401750  3/18/2017   0
12  2142311 2/28/2018   20
13  48280   8/15/2016   0
14  281301  6/11/2017   0
15  48280   8/15/2016   0
16  369080  5/17/2017   0
17  281301  6/11/2017   0
18  977001  2/21/2018   150
19  369080  3/8/2018    10
20  977001  3/21/2018   150
21  401750  3/18/2017   0
22  2142311 3/22/2018   22
23  1722942 3/28/2018   56
24  1004805 3/19/2018   90
25  48280   8/15/2016   0
26  281301  6/11/2017   0
27  2142311 4/28/2018   40
28  369080  3/8/2018    0
29  1722942 4/18/2018   26
30  977001  3/21/2018   0
31  1004805 3/19/2018   0
32  401750  3/18/2017   0
33  48280   8/15/2016   0
34  281301  6/11/2017   0
35  1722942 4/18/2018   0
36  369080  3/8/2018    0
37  2142311 5/28/2018   32
38  1004805 3/19/2018   0
39  401750  3/18/2017   0

Current code:

import pandas as pd
import warnings
import datetime as dt

warnings.filterwarnings('ignore')
df = pd.read_csv("sample.csv")
#print(df.head())
df1=df

print(df1['last_Transaction'].min())

print(df1['last_Transaction'].max())

Output:


1/13/2018
8/15/2016

Why is the min date 1/13/2018? and max date 8/15/2016?

Saikrishna Rajaraman
  • 3,205
  • 2
  • 16
  • 29
Alankar Gupta
  • 201
  • 3
  • 12

0 Answers0