Python Forum
pandas restricting csv read to certain rows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pandas restricting csv read to certain rows
#1
Dear Pandas Experts,

I am tryig to extract data from a .csv file that contains columns called CarId, IssueDate

import pandas as pd
    train = pd.read_csv('train.csv', index_col=False, encoding="ISO-8859-1")
The issue date is of format "mm/dd/yyyy".
I want to get only those rows that have a year between 2012 and 2016.

Can someone help with that? I have no idea how to make this efficient i.e
maybe filtering before all the data is extracted.
Reply


Messages In This Thread
pandas restricting csv read to certain rows - by metalray - Dec-06-2017, 10:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas read csv file in 'date/time' chunks MorganSamage 4 1,716 Feb-13-2023, 11:24 AM
Last Post: MorganSamage
Smile How to further boost the data read write speed using pandas tjk9501 1 1,272 Nov-14-2022, 01:46 PM
Last Post: jefsummers
  Pandas Dataframe Filtering based on rows mvdlm 0 1,449 Apr-02-2022, 06:39 PM
Last Post: mvdlm
  [Pandas] Help with finding only non-matching rows LowEnd 3 3,583 Nov-12-2021, 02:34 PM
Last Post: jefsummers
  Can't read text file with pandas zinho 6 12,147 May-24-2020, 06:13 AM
Last Post: azajali43
  Read json array data by pandas vipinct 0 1,957 Apr-13-2020, 02:24 PM
Last Post: vipinct
  pandas head() not reading all rows naab 0 1,818 Apr-07-2020, 01:06 PM
Last Post: naab
  getting trailing zeros with 1 during pandas read fullstop 1 3,620 Jan-05-2020, 04:01 PM
Last Post: ichabod801
  How to add a few empty rows into a pandas dataframe python_newbie09 2 16,349 Sep-20-2019, 08:52 AM
Last Post: python_newbie09
  Read Nested JSON with pandas.io.json palo173 4 9,601 Apr-29-2019, 01:25 PM
Last Post: palo173

Forum Jump:

User Panel Messages

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