@@ -119,7 +119,8 @@ class StringDtype(StorageExtensionDtype):
119119
120120 Attributes
121121 ----------
122- None
122+ storage
123+ na_value
123124
124125 Methods
125126 -------
@@ -149,8 +150,40 @@ def name(self) -> str: # type: ignore[override]
149150 # follows NumPy semantics, which uses nan.
150151 @property
151152 def na_value (self ) -> libmissing .NAType | float : # type: ignore[override]
153+ """
154+ The missing value representation for this dtype.
155+
156+ This value indicates which missing value semantics are used by this dtype.
157+ Returns ``np.nan`` for the default string dtype with NumPy semantics,
158+ and ``pd.NA`` for the opt-in string dtype with pandas NA semantics.
159+
160+ Examples
161+ --------
162+ >>> ser = pd.Series(["a", "b"])
163+ >>> ser.dtype
164+ <StringDtype(na_value=nan)>
165+ >>> ser.dtype.na_value
166+ nan
167+ """
152168 return self ._na_value
153169
170+ @property
171+ def storage (self ) -> str :
172+ """
173+ The storage backend for this dtype.
174+
175+ Can be either "pyarrow" or "python".
176+
177+ Examples
178+ --------
179+ >>> ser = pd.Series(["a", "b"])
180+ >>> ser.dtype
181+ <StringDtype(na_value=nan)>
182+ >>> ser.dtype.storage
183+ 'pyarrow'
184+ """
185+ return self ._storage
186+
154187 _metadata = ("storage" , "_na_value" ) # type: ignore[assignment]
155188
156189 def __init__ (
@@ -185,7 +218,7 @@ def __init__(
185218 elif na_value is not libmissing .NA :
186219 raise ValueError (f"'na_value' must be np.nan or pd.NA, got { na_value } " )
187220
188- self .storage = cast (str , storage )
221+ self ._storage = cast (str , storage )
189222 self ._na_value = na_value
190223
191224 def __repr__ (self ) -> str :
@@ -211,7 +244,7 @@ def __eq__(self, other: object) -> bool:
211244
212245 def __setstate__ (self , state : MutableMapping [str , Any ]) -> None :
213246 # back-compat for pandas < 2.3, where na_value did not yet exist
214- self .storage = state .pop ("storage" , "python" )
247+ self ._storage = state .pop ("storage" , "python" )
215248 self ._na_value = state .pop ("_na_value" , libmissing .NA )
216249
217250 def __hash__ (self ) -> int :
@@ -306,7 +339,7 @@ def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None:
306339 # if both python and pyarrow storage -> priority to pyarrow
307340 storage = "pyarrow"
308341 else :
309- storage = next (iter (storages )) # type: ignore[assignment]
342+ storage = next (iter (storages ))
310343
311344 na_value : libmissing .NAType | float
312345 if len (na_values ) == 2 :
0 commit comments