Skip to content

Commit 2a270d8

Browse files
authored
DOC: Fixing EX01 - Added examples (#53370)
Examples for dtype, show_version
1 parent cb26eea commit 2a270d8

File tree

3 files changed

+72
-9
lines changed

3 files changed

+72
-9
lines changed

ci/code_checks.sh

-9
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
137137
pandas.errors.PyperclipWindowsException \
138138
pandas.errors.UnsortedIndexError \
139139
pandas.errors.UnsupportedFunctionCall \
140-
pandas.show_versions \
141140
pandas.test \
142141
pandas.NaT \
143142
pandas.Timestamp.as_unit \
@@ -170,14 +169,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
170169
pandas.Period.asfreq \
171170
pandas.Period.now \
172171
pandas.arrays.PeriodArray \
173-
pandas.Int8Dtype \
174-
pandas.Int16Dtype \
175-
pandas.Int32Dtype \
176-
pandas.Int64Dtype \
177-
pandas.UInt8Dtype \
178-
pandas.UInt16Dtype \
179-
pandas.UInt32Dtype \
180-
pandas.UInt64Dtype \
181172
pandas.NA \
182173
pandas.CategoricalDtype.categories \
183174
pandas.CategoricalDtype.ordered \

pandas/core/arrays/integer.py

+50
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,56 @@ class IntegerArray(NumericArray):
147147
Methods
148148
-------
149149
None
150+
151+
Examples
152+
--------
153+
For Int8Dtype:
154+
155+
>>> ser = pd.Series([2, pd.NA], dtype=pd.Int8Dtype())
156+
>>> ser.dtype
157+
Int8Dtype()
158+
159+
For Int16Dtype:
160+
161+
>>> ser = pd.Series([2, pd.NA], dtype=pd.Int16Dtype())
162+
>>> ser.dtype
163+
Int16Dtype()
164+
165+
For Int32Dtype:
166+
167+
>>> ser = pd.Series([2, pd.NA], dtype=pd.Int32Dtype())
168+
>>> ser.dtype
169+
Int32Dtype()
170+
171+
For Int64Dtype:
172+
173+
>>> ser = pd.Series([2, pd.NA], dtype=pd.Int64Dtype())
174+
>>> ser.dtype
175+
Int64Dtype()
176+
177+
For UInt8Dtype:
178+
179+
>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt8Dtype())
180+
>>> ser.dtype
181+
UInt8Dtype()
182+
183+
For UInt16Dtype:
184+
185+
>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt16Dtype())
186+
>>> ser.dtype
187+
UInt16Dtype()
188+
189+
For UInt32Dtype:
190+
191+
>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt32Dtype())
192+
>>> ser.dtype
193+
UInt32Dtype()
194+
195+
For UInt64Dtype:
196+
197+
>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt64Dtype())
198+
>>> ser.dtype
199+
UInt64Dtype()
150200
"""
151201

152202
# create the Dtype

pandas/util/_print_versions.py

+22
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,28 @@ def show_versions(as_json: str | bool = False) -> None:
114114
* If str, it will be considered as a path to a file.
115115
Info will be written to that file in JSON format.
116116
* If True, outputs info in JSON format to the console.
117+
118+
Examples
119+
--------
120+
>>> pd.show_versions() # doctest: +SKIP
121+
Your output may look something like this:
122+
INSTALLED VERSIONS
123+
------------------
124+
commit : 37ea63d540fd27274cad6585082c91b1283f963d
125+
python : 3.10.6.final.0
126+
python-bits : 64
127+
OS : Linux
128+
OS-release : 5.10.102.1-microsoft-standard-WSL2
129+
Version : #1 SMP Wed Mar 2 00:30:59 UTC 2022
130+
machine : x86_64
131+
processor : x86_64
132+
byteorder : little
133+
LC_ALL : None
134+
LANG : en_GB.UTF-8
135+
LOCALE : en_GB.UTF-8
136+
pandas : 2.0.1
137+
numpy : 1.24.3
138+
...
117139
"""
118140
sys_info = _get_sys_info()
119141
deps = _get_dependency_info()

0 commit comments

Comments
 (0)