Skip to content

Commit 4ebd7e2

Browse files
ko-ya346yehoshuadimarsky
authored andcommitted
Ko ya346/update import doc (pandas-dev#45346)
1 parent 03abe36 commit 4ebd7e2

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

pandas/core/dtypes/concat.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -194,24 +194,22 @@ def union_categoricals(
194194
195195
Examples
196196
--------
197-
>>> from pandas.api.types import union_categoricals
198-
199197
If you want to combine categoricals that do not necessarily have
200198
the same categories, `union_categoricals` will combine a list-like
201199
of categoricals. The new categories will be the union of the
202200
categories being combined.
203201
204202
>>> a = pd.Categorical(["b", "c"])
205203
>>> b = pd.Categorical(["a", "b"])
206-
>>> union_categoricals([a, b])
204+
>>> pd.api.types.union_categoricals([a, b])
207205
['b', 'c', 'a', 'b']
208206
Categories (3, object): ['b', 'c', 'a']
209207
210208
By default, the resulting categories will be ordered as they appear
211209
in the `categories` of the data. If you want the categories to be
212210
lexsorted, use `sort_categories=True` argument.
213211
214-
>>> union_categoricals([a, b], sort_categories=True)
212+
>>> pd.api.types.union_categoricals([a, b], sort_categories=True)
215213
['b', 'c', 'a', 'b']
216214
Categories (3, object): ['a', 'b', 'c']
217215
@@ -221,15 +219,15 @@ def union_categoricals(
221219
222220
>>> a = pd.Categorical(["a", "b"], ordered=True)
223221
>>> b = pd.Categorical(["a", "b", "a"], ordered=True)
224-
>>> union_categoricals([a, b])
222+
>>> pd.api.types.union_categoricals([a, b])
225223
['a', 'b', 'a', 'b', 'a']
226224
Categories (2, object): ['a' < 'b']
227225
228226
Raises `TypeError` because the categories are ordered and not identical.
229227
230228
>>> a = pd.Categorical(["a", "b"], ordered=True)
231229
>>> b = pd.Categorical(["a", "b", "c"], ordered=True)
232-
>>> union_categoricals([a, b])
230+
>>> pd.api.types.union_categoricals([a, b])
233231
Traceback (most recent call last):
234232
...
235233
TypeError: to union ordered Categoricals, all categories must be the same
@@ -241,7 +239,7 @@ def union_categoricals(
241239
242240
>>> a = pd.Categorical(["a", "b", "c"], ordered=True)
243241
>>> b = pd.Categorical(["c", "b", "a"], ordered=True)
244-
>>> union_categoricals([a, b], ignore_order=True)
242+
>>> pd.api.types.union_categoricals([a, b], ignore_order=True)
245243
['a', 'b', 'c', 'c', 'b', 'a']
246244
Categories (3, object): ['a', 'b', 'c']
247245
@@ -251,7 +249,7 @@ def union_categoricals(
251249
252250
>>> a = pd.Series(["b", "c"], dtype='category')
253251
>>> b = pd.Series(["a", "b"], dtype='category')
254-
>>> union_categoricals([a, b])
252+
>>> pd.api.types.union_categoricals([a, b])
255253
['b', 'c', 'a', 'b']
256254
Categories (3, object): ['b', 'c', 'a']
257255
"""

pandas/io/stata.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -3158,21 +3158,22 @@ class StataWriter117(StataWriter):
31583158
31593159
Examples
31603160
--------
3161-
>>> from pandas.io.stata import StataWriter117
31623161
>>> data = pd.DataFrame([[1.0, 1, 'a']], columns=['a', 'b', 'c'])
3163-
>>> writer = StataWriter117('./data_file.dta', data)
3162+
>>> writer = pd.io.stata.StataWriter117('./data_file.dta', data)
31643163
>>> writer.write_file()
31653164
31663165
Directly write a zip file
31673166
>>> compression = {"method": "zip", "archive_name": "data_file.dta"}
3168-
>>> writer = StataWriter117('./data_file.zip', data, compression=compression)
3167+
>>> writer = pd.io.stata.StataWriter117(
3168+
... './data_file.zip', data, compression=compression
3169+
... )
31693170
>>> writer.write_file()
31703171
31713172
Or with long strings stored in strl format
31723173
>>> data = pd.DataFrame([['A relatively long string'], [''], ['']],
31733174
... columns=['strls'])
3174-
>>> writer = StataWriter117('./data_file_with_long_strings.dta', data,
3175-
... convert_strl=['strls'])
3175+
>>> writer = pd.io.stata.StataWriter117(
3176+
... './data_file_with_long_strings.dta', data, convert_strl=['strls'])
31763177
>>> writer.write_file()
31773178
"""
31783179

0 commit comments

Comments
 (0)