def test_repr_flights_carrier_5(self): pd_s = self.pd_flights()["Carrier"].head(5) ed_s = ed.Series(ES_TEST_CLIENT, FLIGHTS_INDEX_NAME, "Carrier").head(5) pd_repr = repr(pd_s) ed_repr = repr(ed_s) assert pd_repr == ed_repr
def test_head_tail(self): pd_s = self.pd_flights()["Carrier"] ed_s = ed.Series(ES_TEST_CLIENT, FLIGHTS_INDEX_NAME, "Carrier") pd_s_head = pd_s.head(10) ed_s_head = ed_s.head(10) assert_pandas_eland_series_equal(pd_s_head, ed_s_head) pd_s_tail = pd_s.tail(10) ed_s_tail = ed_s.tail(10) assert_pandas_eland_series_equal(pd_s_tail, ed_s_tail)
def test_name(self): # deep copy pandas DataFrame as .name alters this reference frame pd_series = self.pd_flights()["Carrier"].copy(deep=True) ed_series = ed.Series(ES_TEST_CLIENT, FLIGHTS_INDEX_NAME, "Carrier") assert_pandas_eland_series_equal(pd_series, ed_series) assert ed_series.name == pd_series.name pd_series.name = "renamed1" ed_series.name = "renamed1" assert_pandas_eland_series_equal(pd_series, ed_series) assert ed_series.name == pd_series.name pd_series.name = "renamed2" ed_series.name = "renamed2" assert_pandas_eland_series_equal(pd_series, ed_series) assert ed_series.name == pd_series.name
def test_rename(self): pd_carrier = self.pd_flights()["Carrier"] ed_carrier = ed.Series(ES_TEST_CLIENT, FLIGHTS_INDEX_NAME, "Carrier") assert_pandas_eland_series_equal(pd_carrier, ed_carrier) pd_renamed = pd_carrier.rename("renamed") ed_renamed = ed_carrier.rename("renamed") print(pd_renamed) print(ed_renamed) print(ed_renamed.es_info()) assert_pandas_eland_series_equal(pd_renamed, ed_renamed) pd_renamed2 = pd_renamed.rename("renamed2") ed_renamed2 = ed_renamed.rename("renamed2") print(ed_renamed2.es_info()) assert "renamed2" == ed_renamed2.name assert_pandas_eland_series_equal(pd_renamed2, ed_renamed2)
def test_sample(self): ed_s = ed.Series(ES_TEST_CLIENT, FLIGHTS_INDEX_NAME, "Carrier") pd_s = self.build_from_index(ed_s.sample(n=10, random_state=self.SEED)) ed_s_sample = ed_s.sample(n=10, random_state=self.SEED) assert_pandas_eland_series_equal(pd_s, ed_s_sample)
def test_repr_empty_series(self): pd_s = self.pd_flights()["Carrier"].head(0) ed_s = ed.Series(ES_TEST_CLIENT, FLIGHTS_INDEX_NAME, "Carrier").head(0) assert repr(pd_s) == repr(ed_s)