2
2
from functools import wraps
3
3
import re
4
4
import textwrap
5
- from typing import TYPE_CHECKING , Any , Callable , Dict , List , Pattern , Type , Union
5
+ from typing import (
6
+ TYPE_CHECKING ,
7
+ Any ,
8
+ Callable ,
9
+ Dict ,
10
+ List ,
11
+ Optional ,
12
+ Pattern ,
13
+ Type ,
14
+ Union ,
15
+ )
6
16
import warnings
7
17
8
18
import numpy as np
@@ -245,7 +255,7 @@ def g(x):
245
255
def str_format (
246
256
arr ,
247
257
format : str ,
248
- name : str = None ,
258
+ name : Optional [ str ] = None ,
249
259
positional_only : bool = False ,
250
260
how_na : str = "any" ,
251
261
) -> "Series" :
@@ -254,16 +264,16 @@ def str_format(
254
264
255
265
Parameters
256
266
----------
257
- arr: DataFrame or Series
267
+ arr : DataFrame or Series
258
268
The values to format.
259
269
format : str
260
270
format string.
261
- name: Label, optional
271
+ name : Label, optional
262
272
The name of the returned Series.
263
- positional_only: bool, default False
273
+ positional_only : bool, default False
264
274
If True, only allow positional parameters (i.e. allow "{}", but not "{key}").
265
275
Setting to ``True`` will improve performance.
266
- how_na: str, one of {"all", "any"}, default "any"
276
+ how_na : str, one of {"all", "any"}, default "any"
267
277
If "all", return ``NA`` if all values in row are nan values.
268
278
If "any", return ``NA`` if at least one of the values in row is a nan value.
269
279
@@ -294,7 +304,7 @@ def str_format(
294
304
3 Population: 21,477,737
295
305
dtype: string
296
306
297
- >>> df.format("{} ({}): {:,}")
307
+ >>> df.format("{} ({}): {:,}")
298
308
1 California (CA): 39,512,223
299
309
2 Texas (TX): 28,995,881
300
310
3 Florida (FL): 21,477,737
0 commit comments