Python Forum
Pandas and Date: problem with operator.How to resolve
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas and Date: problem with operator.How to resolve
#1
Hi.

I have a file csv (es10.csv) like this:
Output:
Conc. Date I II 8926 18/11/2014 1 22 8927 20/11/2014 2 33 8928 30/11/2014 3 15 8929 18/12/2014 4 80 8930 28/12/2014 8 60 8931 31/12/2014 9 12
Note: Date = day**month**Year

Now, i would like to get the following output:
Output:
Conc. Date I II 8929 18/12/2014 4 1 8930 28/12/2014 8 0 8931 31/12/2014 9 1
Note: the value of the date must be greater than 30/11/2014

My code is:

df=pd.read_csv("esv10.csv",encoding='windows-1252',sep="\t",decimal=',',keep_default_na=False, na_values=[''], converters={"Conc.":str},)
pd.options.display.float_format = '{:,.0f}'.format
myfilter=df["Date"]>"30/11/2014"
df= df.where(myfilter ,axis=1).dropna()
print(df)
If i use the operator ==, output = 8928 30/11/2014 3 15
Is it possible to use operator: > or < or =!?

Thanks
Reply


Messages In This Thread
Pandas and Date: problem with operator.How to resolve - by frame - May-12-2019, 10:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas read csv file in 'date/time' chunks MorganSamage 4 1,748 Feb-13-2023, 11:24 AM
Last Post: MorganSamage
  Does a pandas have a date without a time? AlekseyPython 6 4,991 Feb-10-2021, 09:24 AM
Last Post: Naheed
  problem with opening csv file in pandas saratha 2 2,580 Jul-21-2020, 10:55 AM
Last Post: saratha
  replace nan values by mean group by date.year, date.month wissam1974 5 8,541 Feb-19-2020, 06:25 PM
Last Post: AnkitGupta
  Obtaining Correct Date In Pandas DataFrame eddywinch82 14 6,068 Feb-17-2020, 11:45 AM
Last Post: eddywinch82
  Problem with date type (object to datetime) karlito 6 3,669 Oct-16-2019, 08:07 AM
Last Post: karlito
  Trying to Pass date to pandas search from input prompt curranjohn46 1 2,138 Oct-10-2019, 10:01 AM
Last Post: curranjohn46
  Need help passing date to pandas query curranjohn46 1 5,509 Oct-10-2019, 09:59 AM
Last Post: curranjohn46
  How to resolve scipy differences? Oliver 2 3,975 Oct-08-2019, 08:40 PM
Last Post: Oliver
  Pandas converting date to epoch randor 2 3,956 Jul-16-2019, 02:41 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020