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 8447289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:08:52+00:00 2026-06-10T10:08:52+00:00

This code: import pandas as pd from StringIO import StringIO data = date,c1\n2012-07-31 02:00,1.1\n2012-07-31

  • 0

This code:

import pandas as pd
from StringIO import StringIO

data = "date,c1\n2012-07-31 02:00,1.1\n2012-07-31 02:15,2.2\n2012-07-31 02:30,3.3\n"

df1 = pd.read_csv(StringIO(data),parse_dates=True).set_index(('date'))
df2 = pd.read_csv(StringIO(data),parse_dates=[0] ).set_index(('date'))

print "df1:\n{index}".format(index=df1.index)
print "df2:\n{index}".format(index=df2.index)

returns:

df1:
array([2012-07-31 02:00, 2012-07-31 02:15, 2012-07-31 02:30], dtype=object)
df2:
<class 'pandas.tseries.index.DatetimeIndex'>
[2012-07-31 02:00:00, ..., 2012-07-31 02:30:00]
Length: 3, Freq: None, Timezone: None

Is this difference between df1 and df2 a bug,feature, or have I misunderstood something?

  • 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-10T10:08:53+00:00Added an answer on June 10, 2026 at 10:08 am

    Looks like a bug to me. I created an issue for this.

    Note that by using the *index_col* argument it is possible to set the index.

    In [15]: df = pd.read_csv(StringIO(data),parse_dates=[0], index_col=0)
    
    In [15]: df.index
    <class 'pandas.tseries.index.DatetimeIndex'>
    [2012-07-31 02:00:00, ..., 2012-07-31 02:30:00]
    Length: 3, Freq: None, Timezone: None
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this code: import socket store = [] scount = 0 while True: scount+=1
for this code: import sys import gevent from gevent import monkey monkey.patch_all() import requests
i have this code: import csv import collections def do_work(): (data,counter)=get_file('thefile.csv') b=samples_subset1(data, counter,'/pythonwork/samples_subset3.csv',500) return
I'm using WSGI and trying to access the get/post data, using this code: import
from this code #import AsyncImageView.h #import ImageCache.h #import ImageCacheObject.h static ImageCache *imageCache = nil;
With this code: import scipy from scipy import * x = r_[1:15] print x
I have this code import json from pprint import pprint json_data=open('bookmarks.json') jdata = json.load(json_data)
Im new to Haskell!! I wrote this code: import Data.List inputIndex :: [String] ->
As in this code: import Data.Char groupsOf _ [] = [] groupsOf n xs
I'm still trying to crack this code: import Data.Char groupsOf _ [] = []

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.