0

How can I print all the rows in the series generated?

isDateGreater = newDF.Effective_Date > newDF.Paid_Off_Time
print("the size of isDateGreater " + str(isDateGreater))


the size of isDateGreater 0      False
1      False
2      False
3      False
4      False
 
481    False
482    False
483    False
484    False
485    False
Length: 486, dtype: bool



Effective_Date      Paid_Off_Time
08/09/2016          25/09/2016
28/09/2016          29/09/2016
18/09/2016          1/09/2016
10/09/2016          5/09/2016

EDIT Issue If there are 10 000 rows in the data set, when I print out, I want to print ALL 10.000 rows, currently with the code above it prints only 9 rows.

bibscy
  • 2,598
  • 4
  • 34
  • 82
  • Use `df = newDF[newDF.Effective_Date > newDF.Paid_Off_Time]` – jezrael Jul 02 '20 at 07:35
  • It doesn't return a boolean series. – bibscy Jul 02 '20 at 07:41
  • Not understand, what should be expected output? – jezrael Jul 02 '20 at 07:41
  • As printed in the original questions, when you compare the values of 2 columns, a panda boolean series should be returned with False, True... The problem is that when I do print, I want to print ALL 486 rows – bibscy Jul 02 '20 at 07:43
  • 1
    Sorry, is possible create some sample data and expected output from this sample data? Because not idea what need (and why my solution not working) – jezrael Jul 02 '20 at 07:44

1 Answers1

0

Problem is data are not converted to datetimes, so here are compared strings.

So need to_datetime with dayfirst=True:

newDF.Effective_Date = pd.to_datetime(newDF.Effective_Date, dayfirst=True)
newDF.Paid_Off_Time= pd.to_datetime(newDF.Paid_Off_Time, dayfirst=True)

If need datetimes without times add Series.dt.normalize:

newDF.Effective_Date = pd.to_datetime(newDF.Effective_Date, dayfirst=True).dt.normalize()
newDF.Paid_Off_Time= pd.to_datetime(newDF.Paid_Off_Time, dayfirst=True).dt.normalize()

And then compare:

df = newDF[newDF.Effective_Date > newDF.Paid_Off_Time]
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252