Skip to content

Commit a4bca8c

Browse files
Chang Shewesm
Chang She
authored andcommitted
TST: using multiple date col as index
1 parent 58c2a2b commit a4bca8c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pandas/io/tests/test_parsers.py

+18
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,24 @@ def test_multiple_date_cols_with_header(self):
197197
df = read_csv(StringIO(data), parse_dates={'nominal': [1, 2]})
198198
self.assert_(not isinstance(df.nominal[0], basestring))
199199

200+
def test_multiple_date_cols_index(self):
201+
data = """\
202+
ID,date,NominalTime,ActualTime,TDew,TAir,Windspeed,Precip,WindDir
203+
KORD1,19990127, 19:00:00, 18:56:00, 0.8100, 2.8100, 7.2000, 0.0000, 280.0000
204+
KORD2,19990127, 20:00:00, 19:56:00, 0.0100, 2.2100, 7.2000, 0.0000, 260.0000
205+
KORD3,19990127, 21:00:00, 20:56:00, -0.5900, 2.2100, 5.7000, 0.0000, 280.0000
206+
KORD4,19990127, 21:00:00, 21:18:00, -0.9900, 2.0100, 3.6000, 0.0000, 270.0000
207+
KORD5,19990127, 22:00:00, 21:56:00, -0.5900, 1.7100, 5.1000, 0.0000, 290.0000
208+
KORD6,19990127, 23:00:00, 22:56:00, -0.5900, 1.7100, 4.6000, 0.0000, 280.0000"""
209+
210+
xp = read_csv(StringIO(data), parse_dates={'nominal': [1, 2]})
211+
df = read_csv(StringIO(data), parse_dates={'nominal': [1, 2]},
212+
index_col='nominal')
213+
assert_frame_equal(xp.set_index('nominal'), df)
214+
df2 = read_csv(StringIO(data), parse_dates={'nominal': [1, 2]},
215+
index_col=0)
216+
assert_frame_equal(df2, df)
217+
200218
def test_index_col_named(self):
201219
data = """\
202220
ID,date,NominalTime,ActualTime,TDew,TAir,Windspeed,Precip,WindDir

0 commit comments

Comments
 (0)