/usr/local/lib64/python3.6/site-packages/pandas/tests/frame/methods
NameSizeModeActions
__pycache__/-0755rm
test_align.py103390644editdlrm
test_append.py73990644editdlrm
test_asfreq.py19700644editdlrm
test_asof.py57670644editdlrm
test_assign.py29820644editdlrm
test_astype.py210270644editdlrm
test_at_time.py32050644editdlrm
test_between_time.py36750644editdlrm
test_clip.py60280644editdlrm
test_combine.py13590644editdlrm
test_combine_first.py127480644editdlrm
test_compare.py61580644editdlrm
test_count.py10680644editdlrm
test_cov_corr.py118880644editdlrm
test_describe.py124920644editdlrm
test_diff.py73740644editdlrm
test_drop.py156620644editdlrm
test_droplevel.py8550644editdlrm
test_drop_duplicates.py133870644editdlrm
test_duplicated.py31910644editdlrm
test_explode.py52940644editdlrm
test_filter.py49330644editdlrm
test_first_and_last.py18030644editdlrm
test_head_tail.py11940644editdlrm
test_interpolate.py118160644editdlrm
test_isin.py73240644editdlrm
test_nlargest.py67310644editdlrm
test_pct_change.py34360644editdlrm
test_pop.py12260644editdlrm
test_quantile.py180280644editdlrm
test_rank.py113770644editdlrm
test_reindex_like.py11870644editdlrm
test_rename.py125430644editdlrm
test_rename_axis.py40740644editdlrm
test_replace.py592300644editdlrm
test_reset_index.py125060644editdlrm
test_round.py79160644editdlrm
test_select_dtypes.py121040644editdlrm
test_set_index.py195710644editdlrm
test_shift.py103240644editdlrm
test_sort_index.py256780644editdlrm
test_sort_values.py253580644editdlrm
test_to_dict.py99890644editdlrm
test_to_period.py9840644editdlrm
test_to_records.py139810644editdlrm
test_to_timestamp.py40200644editdlrm
test_transpose.py24260644editdlrm
test_truncate.py41800644editdlrm
test_tz_convert.py34150644editdlrm
test_tz_localize.py6660644editdlrm
test_update.py42590644editdlrm
test_value_counts.py26310644editdlrm
__init__.py2290644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/pandas/tests/frame/methods/test_at_time.py (3205B)
from datetime import time import numpy as np import pytest import pytz from pandas import DataFrame, date_range import pandas._testing as tm class TestAtTime: def test_at_time(self): rng = date_range("1/1/2000", "1/5/2000", freq="5min") ts = DataFrame(np.random.randn(len(rng), 2), index=rng) rs = ts.at_time(rng[1]) assert (rs.index.hour == rng[1].hour).all() assert (rs.index.minute == rng[1].minute).all() assert (rs.index.second == rng[1].second).all() result = ts.at_time("9:30") expected = ts.at_time(time(9, 30)) tm.assert_frame_equal(result, expected) result = ts.loc[time(9, 30)] expected = ts.loc[(rng.hour == 9) & (rng.minute == 30)] tm.assert_frame_equal(result, expected) # midnight, everything rng = date_range("1/1/2000", "1/31/2000") ts = DataFrame(np.random.randn(len(rng), 3), index=rng) result = ts.at_time(time(0, 0)) tm.assert_frame_equal(result, ts) # time doesn't exist rng = date_range("1/1/2012", freq="23Min", periods=384) ts = DataFrame(np.random.randn(len(rng), 2), rng) rs = ts.at_time("16:00") assert len(rs) == 0 @pytest.mark.parametrize( "hour", ["1:00", "1:00AM", time(1), time(1, tzinfo=pytz.UTC)] ) def test_at_time_errors(self, hour): # GH#24043 dti = date_range("2018", periods=3, freq="H") df = DataFrame(list(range(len(dti))), index=dti) if getattr(hour, "tzinfo", None) is None: result = df.at_time(hour) expected = df.iloc[1:2] tm.assert_frame_equal(result, expected) else: with pytest.raises(ValueError, match="Index must be timezone"): df.at_time(hour) def test_at_time_tz(self): # GH#24043 dti = date_range("2018", periods=3, freq="H", tz="US/Pacific") df = DataFrame(list(range(len(dti))), index=dti) result = df.at_time(time(4, tzinfo=pytz.timezone("US/Eastern"))) expected = df.iloc[1:2] tm.assert_frame_equal(result, expected) def test_at_time_raises(self): # GH#20725 df = DataFrame([[1, 2, 3], [4, 5, 6]]) msg = "Index must be DatetimeIndex" with pytest.raises(TypeError, match=msg): # index is not a DatetimeIndex df.at_time("00:00") @pytest.mark.parametrize("axis", ["index", "columns", 0, 1]) def test_at_time_axis(self, axis): # issue 8839 rng = date_range("1/1/2000", "1/5/2000", freq="5min") ts = DataFrame(np.random.randn(len(rng), len(rng))) ts.index, ts.columns = rng, rng indices = rng[(rng.hour == 9) & (rng.minute == 30) & (rng.second == 0)] if axis in ["index", 0]: expected = ts.loc[indices, :] elif axis in ["columns", 1]: expected = ts.loc[:, indices] result = ts.at_time("9:30", axis=axis) # Without clearing freq, result has freq 1440T and expected 5T result.index = result.index._with_freq(None) expected.index = expected.index._with_freq(None) tm.assert_frame_equal(result, expected)