Skip to content

Commit

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

Large diffs are not rendered by default.

607 changes: 607 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.

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

import pytest

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 c20f551

Please sign in to comment.