Skip to content

Commit

Permalink
Changes based on review comments
Browse files Browse the repository at this point in the history
* Fixed bug on windows with int32/int64 confusion
* Added unit_test to is_timedelta64_dtype when a string is passed
* Changed unit_test name from `test_slice_indexing` to `test_list_like_indexing`
  • Loading branch information
Jean-Mathieu Deschenes committed Jun 9, 2017
1 parent 269414a commit a88da5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pandas/tests/dtypes/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def test_is_timedelta64_dtype():
assert com.is_timedelta64_dtype(np.timedelta64)
assert com.is_timedelta64_dtype(pd.Series([], dtype="timedelta64[ns]"))

assert not com.is_timedelta64_dtype("0 days 00:00:00")


def test_is_period_dtype():
assert not com.is_period_dtype(object)
Expand Down
7 changes: 4 additions & 3 deletions pandas/tests/indexing/test_timedelta.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ def test_boolean_indexing(self):
[0, 1, 2, 10, 4, 5, 6, 7, 8, 9],
[10, 10, 10, 3, 4, 5, 6, 7, 8, 9]]
for cond, data in zip(conditions, expected_data):
result = df.assign(x=df.mask(cond, 10).astype(df['x'].dtype))
result = df.assign(x=df.mask(cond, 10).astype('int64'))
expected = pd.DataFrame(data,
index=pd.to_timedelta(range(10), unit='s'),
columns=['x'])
columns=['x'],
dtype='int64')
tm.assert_frame_equal(expected, result)

def test_slice_indexing(self):
def test_list_like_indexing(self):
# GH 16637
df = pd.DataFrame({'x': range(10)})
df.index = pd.to_timedelta(range(10), unit='s')
Expand Down

0 comments on commit a88da5a

Please sign in to comment.