Upload hf_env/lib/python3.14/site-packages/tqdm/_tqdm_pandas.py with huggingface_hub
Browse files
hf_env/lib/python3.14/site-packages/tqdm/_tqdm_pandas.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
|
| 3 |
+
__author__ = "github.com/casperdcl"
|
| 4 |
+
__all__ = ['tqdm_pandas']
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def tqdm_pandas(tclass, **tqdm_kwargs):
|
| 8 |
+
"""
|
| 9 |
+
Registers the given `tqdm` instance with
|
| 10 |
+
`pandas.core.groupby.DataFrameGroupBy.progress_apply`.
|
| 11 |
+
"""
|
| 12 |
+
from tqdm import TqdmDeprecationWarning
|
| 13 |
+
|
| 14 |
+
if isinstance(tclass, type) or (getattr(tclass, '__name__', '').startswith(
|
| 15 |
+
'tqdm_')): # delayed adapter case
|
| 16 |
+
TqdmDeprecationWarning(
|
| 17 |
+
"Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm, ...)`.",
|
| 18 |
+
fp_write=getattr(tqdm_kwargs.get('file', None), 'write', sys.stderr.write))
|
| 19 |
+
tclass.pandas(**tqdm_kwargs)
|
| 20 |
+
else:
|
| 21 |
+
TqdmDeprecationWarning(
|
| 22 |
+
"Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm(...))`.",
|
| 23 |
+
fp_write=getattr(tclass.fp, 'write', sys.stderr.write))
|
| 24 |
+
type(tclass).pandas(deprecated_t=tclass)
|