Skip to content

Commit

Permalink
Merge pull request #6156 from jreback/sparc_fix4
Browse files Browse the repository at this point in the history
TST: rec arrays don't support datetimes in creation on certain platforms, related (GH6140)
  • Loading branch information
jreback committed Jan 29, 2014
2 parents 488037b + dcd3ec3 commit cfc1c80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion pandas/tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3967,7 +3967,14 @@ def test_from_records_with_datetimes(self):

arrdata = [np.array([datetime(2005, 3, 1, 0, 0), None])]
dtypes = [('EXPIRY', '<M8[ns]')]
recarray = np.core.records.fromarrays(arrdata, dtype=dtypes)

# this may fail on certain platforms because of a numpy issue
# related GH6140
try:
recarray = np.core.records.fromarrays(arrdata, dtype=dtypes)
except (ValueError):
raise nose.SkipTest('rec arrays with datetimes not supported')

result = DataFrame.from_records(recarray)
assert_frame_equal(result,expected)

Expand Down
8 changes: 4 additions & 4 deletions pandas/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,19 +650,19 @@ def test_loc_setitem_frame_multiples(self):

# multiple setting
df = DataFrame({ 'A' : ['foo','bar','baz'],
'B' : range(3) })
'B' : Series(range(3),dtype=np.int64) })
df.loc[0:1] = df.loc[1:2]
expected = DataFrame({ 'A' : ['bar','baz','baz'],
'B' : [1,2,2] })
'B' : Series([1,2,2],dtype=np.int64) })
assert_frame_equal(df, expected)


# multiple setting with frame on rhs (with M8)
df = DataFrame({ 'date' : date_range('2000-01-01','2000-01-5'),
'val' : range(5) })
'val' : Series(range(5),dtype=np.int64) })
expected = DataFrame({ 'date' : [Timestamp('20000101'),Timestamp('20000102'),Timestamp('20000101'),
Timestamp('20000102'),Timestamp('20000103')],
'val' : [0,1,0,1,2] })
'val' : Series([0,1,0,1,2],dtype=np.int64) })

df.loc[2:4] = df.loc[0:2]
assert_frame_equal(df, expected)
Expand Down

0 comments on commit cfc1c80

Please sign in to comment.