From b1ef07bbff6b43d72f9d1b35dac51380a2984a10 Mon Sep 17 00:00:00 2001 From: kouya takahashi <3kamarin4skaya6@gmail.com> Date: Thu, 13 Jan 2022 22:37:45 +0900 Subject: [PATCH 1/4] DOC:updates documentations union_categoricals --- pandas/core/dtypes/concat.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pandas/core/dtypes/concat.py b/pandas/core/dtypes/concat.py index 83c2668242129..b817aeccdd910 100644 --- a/pandas/core/dtypes/concat.py +++ b/pandas/core/dtypes/concat.py @@ -200,7 +200,7 @@ def union_categoricals( Examples -------- - >>> from pandas.api.types import union_categoricals + >>> import pandas as pd If you want to combine categoricals that do not necessarily have the same categories, `union_categoricals` will combine a list-like @@ -209,7 +209,7 @@ def union_categoricals( >>> a = pd.Categorical(["b", "c"]) >>> b = pd.Categorical(["a", "b"]) - >>> union_categoricals([a, b]) + >>> pd.api.types.union_categoricals([a, b]) ['b', 'c', 'a', 'b'] Categories (3, object): ['b', 'c', 'a'] @@ -217,7 +217,7 @@ def union_categoricals( in the `categories` of the data. If you want the categories to be lexsorted, use `sort_categories=True` argument. - >>> union_categoricals([a, b], sort_categories=True) + >>> pd.api.types.union_categoricals([a, b], sort_categories=True) ['b', 'c', 'a', 'b'] Categories (3, object): ['a', 'b', 'c'] @@ -227,7 +227,7 @@ def union_categoricals( >>> a = pd.Categorical(["a", "b"], ordered=True) >>> b = pd.Categorical(["a", "b", "a"], ordered=True) - >>> union_categoricals([a, b]) + >>> pd.api.types.union_categoricals([a, b]) ['a', 'b', 'a', 'b', 'a'] Categories (2, object): ['a' < 'b'] @@ -235,7 +235,7 @@ def union_categoricals( >>> a = pd.Categorical(["a", "b"], ordered=True) >>> b = pd.Categorical(["a", "b", "c"], ordered=True) - >>> union_categoricals([a, b]) + >>> pd.api.types.union_categoricals([a, b]) Traceback (most recent call last): ... TypeError: to union ordered Categoricals, all categories must be the same @@ -247,7 +247,7 @@ def union_categoricals( >>> a = pd.Categorical(["a", "b", "c"], ordered=True) >>> b = pd.Categorical(["c", "b", "a"], ordered=True) - >>> union_categoricals([a, b], ignore_order=True) + >>> pd.api.types.union_categoricals([a, b], ignore_order=True) ['a', 'b', 'c', 'c', 'b', 'a'] Categories (3, object): ['a', 'b', 'c'] @@ -257,7 +257,7 @@ def union_categoricals( >>> a = pd.Series(["b", "c"], dtype='category') >>> b = pd.Series(["a", "b"], dtype='category') - >>> union_categoricals([a, b]) + >>> pd.api.types.union_categoricals([a, b]) ['b', 'c', 'a', 'b'] Categories (3, object): ['b', 'c', 'a'] """ From 58a00587fbbae4d86226956c4d51d679ad8ad3fc Mon Sep 17 00:00:00 2001 From: kouya takahashi <3kamarin4skaya6@gmail.com> Date: Thu, 13 Jan 2022 22:47:42 +0900 Subject: [PATCH 2/4] DOC:update documentations StataWriter117 --- pandas/io/stata.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 4a50a3dabe5e7..d05856bb1e9b1 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -3159,19 +3159,21 @@ class StataWriter117(StataWriter): -------- >>> from pandas.io.stata import StataWriter117 >>> data = pd.DataFrame([[1.0, 1, 'a']], columns=['a', 'b', 'c']) - >>> writer = StataWriter117('./data_file.dta', data) + >>> writer = pd.io.stata.StataWriter117('./data_file.dta', data) >>> writer.write_file() Directly write a zip file >>> compression = {"method": "zip", "archive_name": "data_file.dta"} - >>> writer = StataWriter117('./data_file.zip', data, compression=compression) + >>> writer = pd.io.stata.StataWriter117( + ... './data_file.zip', data, compression=compression + ... ) >>> writer.write_file() Or with long strings stored in strl format >>> data = pd.DataFrame([['A relatively long string'], [''], ['']], ... columns=['strls']) - >>> writer = StataWriter117('./data_file_with_long_strings.dta', data, - ... convert_strl=['strls']) + >>> writer = pd.io.stata.StataWriter117( + ... './data_file_with_long_strings.dta', data, convert_strl=['strls']) >>> writer.write_file() """ From 7eaa158abf835bfd7a1fd3265550a59d4dcfa377 Mon Sep 17 00:00:00 2001 From: kouya takahashi <3kamarin4skaya6@gmail.com> Date: Thu, 13 Jan 2022 23:12:04 +0900 Subject: [PATCH 3/4] DOC:remove brank --- pandas/core/dtypes/concat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/dtypes/concat.py b/pandas/core/dtypes/concat.py index b817aeccdd910..2635d45ed46f4 100644 --- a/pandas/core/dtypes/concat.py +++ b/pandas/core/dtypes/concat.py @@ -200,7 +200,7 @@ def union_categoricals( Examples -------- - >>> import pandas as pd + >>> import pandas as pd If you want to combine categoricals that do not necessarily have the same categories, `union_categoricals` will combine a list-like From ca91c910f349ece15b89c26056bb7e05f4aecb3e Mon Sep 17 00:00:00 2001 From: kouya takahashi <3kamarin4skaya6@gmail.com> Date: Thu, 13 Jan 2022 23:34:19 +0900 Subject: [PATCH 4/4] DOC: del import row --- pandas/core/dtypes/concat.py | 2 -- pandas/io/stata.py | 1 - 2 files changed, 3 deletions(-) diff --git a/pandas/core/dtypes/concat.py b/pandas/core/dtypes/concat.py index 2635d45ed46f4..a513d41b61c85 100644 --- a/pandas/core/dtypes/concat.py +++ b/pandas/core/dtypes/concat.py @@ -200,8 +200,6 @@ def union_categoricals( Examples -------- - >>> import pandas as pd - If you want to combine categoricals that do not necessarily have the same categories, `union_categoricals` will combine a list-like of categoricals. The new categories will be the union of the diff --git a/pandas/io/stata.py b/pandas/io/stata.py index d05856bb1e9b1..fba51c83ad27a 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -3157,7 +3157,6 @@ class StataWriter117(StataWriter): Examples -------- - >>> from pandas.io.stata import StataWriter117 >>> data = pd.DataFrame([[1.0, 1, 'a']], columns=['a', 'b', 'c']) >>> writer = pd.io.stata.StataWriter117('./data_file.dta', data) >>> writer.write_file()