/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
pandas
/
tests
/
series
/
methods
/
/usr/local/lib64/python3.6/site-packages/pandas/tests/series/methods
mkdir
upload
Name
Size
Mode
Actions
__pycache__/
-
0755
rm
test_align.py
5359
0644
edit
dl
rm
test_append.py
9600
0644
edit
dl
rm
test_argsort.py
2249
0644
edit
dl
rm
test_asfreq.py
3616
0644
edit
dl
rm
test_asof.py
5515
0644
edit
dl
rm
test_astype.py
2628
0644
edit
dl
rm
test_at_time.py
2629
0644
edit
dl
rm
test_autocorr.py
999
0644
edit
dl
rm
test_between.py
1197
0644
edit
dl
rm
test_between_time.py
5086
0644
edit
dl
rm
test_clip.py
3384
0644
edit
dl
rm
test_combine.py
627
0644
edit
dl
rm
test_combine_first.py
3411
0644
edit
dl
rm
test_compare.py
3734
0644
edit
dl
rm
test_convert_dtypes.py
9914
0644
edit
dl
rm
test_count.py
1123
0644
edit
dl
rm
test_cov_corr.py
5215
0644
edit
dl
rm
test_describe.py
4640
0644
edit
dl
rm
test_diff.py
2331
0644
edit
dl
rm
test_drop.py
2986
0644
edit
dl
rm
test_droplevel.py
629
0644
edit
dl
rm
test_drop_duplicates.py
6850
0644
edit
dl
rm
test_duplicated.py
996
0644
edit
dl
rm
test_equals.py
1295
0644
edit
dl
rm
test_explode.py
3538
0644
edit
dl
rm
test_fillna.py
6513
0644
edit
dl
rm
test_first_and_last.py
2042
0644
edit
dl
rm
test_head_tail.py
343
0644
edit
dl
rm
test_interpolate.py
27757
0644
edit
dl
rm
test_isin.py
3445
0644
edit
dl
rm
test_nlargest.py
7121
0644
edit
dl
rm
test_pct_change.py
2968
0644
edit
dl
rm
test_quantile.py
6810
0644
edit
dl
rm
test_rank.py
20287
0644
edit
dl
rm
test_reindex_like.py
1245
0644
edit
dl
rm
test_rename.py
3378
0644
edit
dl
rm
test_rename_axis.py
1503
0644
edit
dl
rm
test_replace.py
15559
0644
edit
dl
rm
test_reset_index.py
4636
0644
edit
dl
rm
test_round.py
1970
0644
edit
dl
rm
test_searchsorted.py
2121
0644
edit
dl
rm
test_shift.py
12595
0644
edit
dl
rm
test_sort_index.py
12277
0644
edit
dl
rm
test_sort_values.py
7981
0644
edit
dl
rm
test_to_dict.py
742
0644
edit
dl
rm
test_to_period.py
1755
0644
edit
dl
rm
test_to_timestamp.py
2616
0644
edit
dl
rm
test_truncate.py
5557
0644
edit
dl
rm
test_tz_convert.py
1008
0644
edit
dl
rm
test_tz_localize.py
3108
0644
edit
dl
rm
test_unstack.py
4208
0644
edit
dl
rm
test_update.py
4213
0644
edit
dl
rm
test_value_counts.py
8136
0644
edit
dl
rm
__init__.py
225
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/pandas/tests/series/methods/test_astype.py
(2628B)
import numpy as np import pytest from pandas import NA, Interval, Series, Timestamp, date_range import pandas._testing as tm class TestAstype: def test_astype_dt64_to_str(self): # GH#10442 : testing astype(str) is correct for Series/DatetimeIndex dti = date_range("2012-01-01", periods=3) result = Series(dti).astype(str) expected = Series(["2012-01-01", "2012-01-02", "2012-01-03"], dtype=object) tm.assert_series_equal(result, expected) def test_astype_dt64tz_to_str(self): # GH#10442 : testing astype(str) is correct for Series/DatetimeIndex dti_tz = date_range("2012-01-01", periods=3, tz="US/Eastern") result = Series(dti_tz).astype(str) expected = Series( [ "2012-01-01 00:00:00-05:00", "2012-01-02 00:00:00-05:00", "2012-01-03 00:00:00-05:00", ], dtype=object, ) tm.assert_series_equal(result, expected) @pytest.mark.parametrize( "values", [ Series(["x", "y", "z"], dtype="string"), Series(["x", "y", "z"], dtype="category"), Series(3 * [Timestamp("2020-01-01", tz="UTC")]), Series(3 * [Interval(0, 1)]), ], ) @pytest.mark.parametrize("errors", ["raise", "ignore"]) def test_astype_ignores_errors_for_extension_dtypes(self, values, errors): # https://github.com/pandas-dev/pandas/issues/35471 if errors == "ignore": expected = values result = values.astype(float, errors="ignore") tm.assert_series_equal(result, expected) else: msg = "(Cannot cast)|(could not convert)" with pytest.raises((ValueError, TypeError), match=msg): values.astype(float, errors=errors) @pytest.mark.parametrize("dtype", [np.float16, np.float32, np.float64]) def test_astype_from_float_to_str(self, dtype): # https://github.com/pandas-dev/pandas/issues/36451 s = Series([0.1], dtype=dtype) result = s.astype(str) expected = Series(["0.1"]) tm.assert_series_equal(result, expected) @pytest.mark.parametrize( "value, string_value", [(None, "None"), (np.nan, "nan"), (NA, "<NA>")], ) def test_astype_to_str_preserves_na(self, value, string_value): # https://github.com/pandas-dev/pandas/issues/36904 s = Series(["a", "b", value], dtype=object) result = s.astype(str) expected = Series(["a", "b", string_value], dtype=object) tm.assert_series_equal(result, expected)
Save
cmd:
run