Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8550569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:58:45+00:00 2026-06-11T13:58:45+00:00

I am using Python 2.7.3 and trying to parse a CSV file using csv

  • 0

I am using Python 2.7.3 and trying to parse a CSV file using csv reader as:

   date_format = '%m/%d/%Y %H:%M%'
   with open(data_base+data_file_short, 'rb') as f:
    reader = csv.reader(f)
    for row in reader:
     #use row here to convert string to date
     dateObj1 = datetime.strptime(row[1],date_format) 

But I keep getting this error:

ValueError: time data ‘PostCreationDate’ does not match format ‘%m/%d/%Y %H:%M’

If i print date it shows 8/3/2012 21:46 which seems to fit with my date_format string.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:58:46+00:00Added an answer on June 11, 2026 at 1:58 pm

    You’re trying to interpret the header row of your CSV as a data row, which (as you can see) will not work.

    Consider using a csv.DictReader instead so you can automatically handle the header row, and don’t have to hardcode the row indices.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to parse a CSV file using Python's csv module (specifically, the DictReader
I am trying to parse a pseudo-CSV file with the python CSV reader, and
I am trying to parse an XML file with python using lxml, but get
Trying to parse the following Python file using the lxml.etree.iterparse function. sampleoutput.xml <item> <title>Item
I am trying to download a file from a website using python and mechanize.
I'm trying to run NeHe's tutorial here using Python 2.7.3, but It's throwing the
I'm trying to parse an xml file using lxml. xml.etree allowed me to simply
I am using eclipse and cygwin gcc compiler. Trying to use the Python.h for
I'm new to Python and am trying to make use of it to parse
I'm trying to parse the result of a HEAD request done using the Python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.