@@ -656,6 +656,12 @@ def isna(self) -> np.ndarray | ExtensionArraySupportsAnyAll:
656656 * ``na_values._is_boolean`` should be True
657657 * `na_values` should implement :func:`ExtensionArray._reduce`
658658 * ``na_values.any`` and ``na_values.all`` should be implemented
659+
660+ Examples
661+ --------
662+ >>> arr = pd.array([1, 2, np.nan, np.nan])
663+ >>> arr.isna()
664+ array([False, False, True, True])
659665 """
660666 raise AbstractMethodError (self )
661667
@@ -882,6 +888,14 @@ def fillna(
882888 -------
883889 ExtensionArray
884890 With NA/NaN filled.
891+
892+ Examples
893+ --------
894+ >>> arr = pd.array([np.nan, np.nan, 2, 3, np.nan, np.nan])
895+ >>> arr.fillna(0)
896+ <IntegerArray>
897+ [0, 0, 2, 3, 0, 0]
898+ Length: 6, dtype: Int64
885899 """
886900 value , method = validate_fillna_kwargs (value , method )
887901
@@ -918,7 +932,13 @@ def dropna(self) -> Self:
918932
919933 Returns
920934 -------
921- pandas.api.extensions.ExtensionArray
935+
936+ Examples
937+ --------
938+ >>> pd.array([1, 2, np.nan]).dropna()
939+ <IntegerArray>
940+ [1, 2]
941+ Length: 2, dtype: Int64
922942 """
923943 # error: Unsupported operand type for ~ ("ExtensionArray")
924944 return self [~ self .isna ()] # type: ignore[operator]
@@ -955,6 +975,14 @@ def shift(self, periods: int = 1, fill_value: object = None) -> ExtensionArray:
955975 ``self.dtype.na_value``.
956976
957977 For 2-dimensional ExtensionArrays, we are always shifting along axis=0.
978+
979+ Examples
980+ --------
981+ >>> arr = pd.array([1, 2, 3])
982+ >>> arr.shift(2)
983+ <IntegerArray>
984+ [<NA>, <NA>, 1]
985+ Length: 3, dtype: Int64
958986 """
959987 # Note: this implementation assumes that `self.dtype.na_value` can be
960988 # stored in an instance of your ExtensionArray with `self.dtype`.
@@ -982,6 +1010,14 @@ def unique(self) -> Self:
9821010 Returns
9831011 -------
9841012 pandas.api.extensions.ExtensionArray
1013+
1014+ Examples
1015+ --------
1016+ >>> arr = pd.array([1, 2, 3, 1, 2, 3])
1017+ >>> arr.unique()
1018+ <IntegerArray>
1019+ [1, 2, 3]
1020+ Length: 3, dtype: Int64
9851021 """
9861022 uniques = unique (self .astype (object ))
9871023 return self ._from_sequence (uniques , dtype = self .dtype )
@@ -1029,6 +1065,12 @@ def searchsorted(
10291065 See Also
10301066 --------
10311067 numpy.searchsorted : Similar method from NumPy.
1068+
1069+ Examples
1070+ --------
1071+ >>> arr = pd.array([1, 2, 3, 5])
1072+ >>> arr.searchsorted([4])
1073+ array([3])
10321074 """
10331075 # Note: the base tests provided by pandas only test the basics.
10341076 # We do not test
@@ -1057,6 +1099,13 @@ def equals(self, other: object) -> bool:
10571099 -------
10581100 boolean
10591101 Whether the arrays are equivalent.
1102+
1103+ Examples
1104+ --------
1105+ >>> arr1 = pd.array([1, 2, np.nan])
1106+ >>> arr2 = pd.array([1, 2, np.nan])
1107+ >>> arr1.equals(arr2)
1108+ True
10601109 """
10611110 if type (self ) != type (other ):
10621111 return False
@@ -1087,6 +1136,14 @@ def isin(self, values) -> npt.NDArray[np.bool_]:
10871136 Returns
10881137 -------
10891138 np.ndarray[bool]
1139+
1140+ Examples
1141+ --------
1142+ >>> arr = pd.array([1, 2, 3])
1143+ >>> arr.isin([1])
1144+ <BooleanArray>
1145+ [True, False, False]
1146+ Length: 3, dtype: boolean
10901147 """
10911148 return isin (np .asarray (self ), values )
10921149
@@ -1151,6 +1208,16 @@ def factorize(
11511208 Notes
11521209 -----
11531210 :meth:`pandas.factorize` offers a `sort` keyword as well.
1211+
1212+ Examples
1213+ --------
1214+ >>> idx1 = pd.PeriodIndex(["2014-01", "2014-01", "2014-02", "2014-02",
1215+ ... "2014-03", "2014-03"], freq="M")
1216+ >>> arr, idx = idx1.factorize()
1217+ >>> arr
1218+ array([0, 0, 1, 1, 2, 2])
1219+ >>> idx
1220+ PeriodIndex(['2014-01', '2014-02', '2014-03'], dtype='period[M]')
11541221 """
11551222 # Implementer note: There are two ways to override the behavior of
11561223 # pandas.factorize
@@ -1657,6 +1724,14 @@ def insert(self, loc: int, item) -> Self:
16571724
16581725 The default implementation relies on _from_sequence to raise on invalid
16591726 items.
1727+
1728+ Examples
1729+ --------
1730+ >>> arr = pd.array([1, 2, 3])
1731+ >>> arr.insert(2, -1)
1732+ <IntegerArray>
1733+ [1, 2, -1, 3]
1734+ Length: 4, dtype: Int64
16601735 """
16611736 loc = validate_insert_loc (loc , len (self ))
16621737
0 commit comments