Skip to content

Commit

Permalink
TST: split series/test_indexing.py (pandas-dev#18614) (pandas-dev#20006)
Browse files Browse the repository at this point in the history
  • Loading branch information
almaleksia authored and pandres committed Mar 10, 2018
1 parent 1a8057c commit 1ee05cf
Show file tree
Hide file tree
Showing 9 changed files with 2,991 additions and 2,874 deletions.
Empty file.
469 changes: 469 additions & 0 deletions pandas/tests/series/indexing/test_alter_index.py

Large diffs are not rendered by default.

610 changes: 610 additions & 0 deletions pandas/tests/series/indexing/test_boolean.py

Large diffs are not rendered by default.

690 changes: 690 additions & 0 deletions pandas/tests/series/indexing/test_datetime.py

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions pandas/tests/series/indexing/test_iloc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# coding=utf-8
# pylint: disable-msg=E1101,W0612

import numpy as np

from pandas import Series

from pandas.compat import lrange, range
from pandas.util.testing import (assert_series_equal,
assert_almost_equal)

JOIN_TYPES = ['inner', 'outer', 'left', 'right']

from pandas.tests.series.common import TestData


class TestIloc(TestData):

def test_iloc(self):
s = Series(np.random.randn(10), index=lrange(0, 20, 2))

for i in range(len(s)):
result = s.iloc[i]
exp = s[s.index[i]]
assert_almost_equal(result, exp)

# pass a slice
result = s.iloc[slice(1, 3)]
expected = s.loc[2:4]
assert_series_equal(result, expected)

# test slice is a view
result[:] = 0
assert (s[1:3] == 0).all()

# list of integers
result = s.iloc[[0, 2, 3, 4, 5]]
expected = s.reindex(s.index[[0, 2, 3, 4, 5]])
assert_series_equal(result, expected)

def test_iloc_nonunique(self):
s = Series([0, 1, 2], index=[0, 1, 0])
assert s.iloc[2] == 2
Loading

0 comments on commit 1ee05cf

Please sign in to comment.