def test_empty_series_with_inplace(self): empty_series = pd.Series(dtype=int) assert_equal(empty_series.dtype, int) out_series = series_to_str(empty_series, inplace=True) assert_equal(out_series.dtype, object) assert_equal(empty_series.dtype, int) assert_equal(len(out_series), 0)
def test_empty_series_with_inplace(self): empty_series = pd.Series(dtype=int) assert_equal(empty_series.dtype, int) out_series = series_to_str(empty_series, inplace=True) assert_equal(out_series.dtype, object) assert_equal(empty_series.dtype, int) assert_equal(len(out_series), 0)
def test_int_col(self): assert_equal(self.int_col.dtype, int) out_series = series_to_str(self.int_col, inplace=False) assert_equal(type(out_series), pd.Series) assert_equal(out_series.dtype, object) assert_equal(self.int_col.dtype, int) assert_equal(sum(pd.isnull(out_series)), 0)
def test_int_col(self): assert_equal(self.int_col.dtype, int) out_series = series_to_str(self.int_col, inplace=False) assert_equal(type(out_series), pd.Series) assert_equal(out_series.dtype, object) assert_equal(self.int_col.dtype, int) assert_equal(sum(pd.isnull(out_series)), 0)
def test_nan_col_with_inplace(self): assert_equal(self.nan_col.dtype, float) nan_cnt_before = sum(pd.isnull(self.nan_col)) out_series = series_to_str(self.nan_col, inplace=True) assert_equal(out_series.dtype, object) assert_equal(self.nan_col.dtype, float) nan_cnt_after = sum(pd.isnull(out_series)) assert_equal(nan_cnt_before, nan_cnt_after)
def test_float_col_with_inplace(self): assert_equal(self.float_col.dtype, float) nan_cnt_before = sum(pd.isnull(self.float_col)) flag = series_to_str(self.float_col, inplace=True) assert_equal(flag, True) assert_equal(self.float_col.dtype, object) nan_cnt_after = sum(pd.isnull(self.float_col)) assert_equal(nan_cnt_before, nan_cnt_after)
def test_nan_col_with_inplace(self): assert_equal(self.nan_col.dtype, float) nan_cnt_before = sum(pd.isnull(self.nan_col)) out_series = series_to_str(self.nan_col, inplace=True) assert_equal(out_series.dtype, object) assert_equal(self.nan_col.dtype, float) nan_cnt_after = sum(pd.isnull(out_series)) assert_equal(nan_cnt_before, nan_cnt_after)
def test_float_col_with_inplace(self): assert_equal(self.float_col.dtype, float) nan_cnt_before = sum(pd.isnull(self.float_col)) flag = series_to_str(self.float_col, inplace=True) assert_equal(flag, True) assert_equal(self.float_col.dtype, object) nan_cnt_after = sum(pd.isnull(self.float_col)) assert_equal(nan_cnt_before, nan_cnt_after)
def test_float_col_with_int_val(self): assert_equal(self.float_col_with_int_val.dtype, float) out_series = series_to_str(self.float_col_with_int_val, inplace=False) assert_equal(type(out_series), pd.Series) assert_equal(out_series.dtype, object) assert_equal(self.float_col_with_int_val.dtype, float) assert_equal(sum(pd.isnull(self.float_col_with_int_val)), sum(pd.isnull(out_series))) for idx, val in self.float_col_with_int_val.iteritems(): if pd.isnull(val): continue assert_equal(str(int(val)), out_series.ix[idx])
def test_float_col_with_int_val(self): assert_equal(self.float_col_with_int_val.dtype, float) out_series = series_to_str(self.float_col_with_int_val, inplace=False) assert_equal(type(out_series), pd.Series) assert_equal(out_series.dtype, object) assert_equal(self.float_col_with_int_val.dtype, float) assert_equal(sum(pd.isnull(self.float_col_with_int_val)), sum(pd.isnull(out_series))) for idx, val in self.float_col_with_int_val.iteritems(): if pd.isnull(val): continue assert_equal(str(int(val)), out_series.ix[idx])
def test_invalid_inplace_flag(self): series_to_str(self.int_col, inplace=None)
def test_invalid_series(self): series_to_str([])
def test_int_col_with_inplace(self): assert_equal(self.int_col.dtype, int) flag = series_to_str(self.int_col, inplace=True) assert_equal(flag, True) assert_equal(self.int_col.dtype, object) assert_equal(sum(pd.isnull(self.int_col)), 0)
def test_invalid_inplace_flag(self): series_to_str(self.int_col, inplace=None)
def test_invalid_series(self): series_to_str([])
def test_int_col_with_inplace(self): assert_equal(self.int_col.dtype, int) flag = series_to_str(self.int_col, inplace=True) assert_equal(flag, True) assert_equal(self.int_col.dtype, object) assert_equal(sum(pd.isnull(self.int_col)), 0)