MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / pandas

Method pandas

pager_lib/tqdm/std.py:768–949  ·  view source on GitHub ↗

Registers the current `tqdm` class with pandas.core. ( frame.DataFrame | series.Series | groupby.(generic.)DataFrameGroupBy | groupby.(generic.)SeriesGroupBy ).progress_apply A new instance will be created ever

(cls, **tqdm_kwargs)

Source from the content-addressed store, hash-verified

766
767 @classmethod
768 def pandas(cls, **tqdm_kwargs):
769 """
770 Registers the current `tqdm` class with
771 pandas.core.
772 ( frame.DataFrame
773 | series.Series
774 | groupby.(generic.)DataFrameGroupBy
775 | groupby.(generic.)SeriesGroupBy
776 ).progress_apply
777
778 A new instance will be created every time `progress_apply` is called,
779 and each instance will automatically `close()` upon completion.
780
781 Parameters
782 ----------
783 tqdm_kwargs : arguments for the tqdm instance
784
785 Examples
786 --------
787 >>> import pandas as pd
788 >>> import numpy as np
789 >>> from tqdm import tqdm
790 >>> from tqdm.gui import tqdm as tqdm_gui
791 >>>
792 >>> df = pd.DataFrame(np.random.randint(0, 100, (100000, 6)))
793 >>> tqdm.pandas(ncols=50) # can use tqdm_gui, optional kwargs, etc
794 >>> # Now you can use `progress_apply` instead of `apply`
795 >>> df.groupby(0).progress_apply(lambda x: x**2)
796
797 References
798 ----------
799 <https://stackoverflow.com/questions/18603270/\
800 progress-indicator-during-pandas-operations-python>
801 """
802 from warnings import catch_warnings, simplefilter
803
804 from pandas.core.frame import DataFrame
805 from pandas.core.series import Series
806 try:
807 with catch_warnings():
808 simplefilter("ignore", category=FutureWarning)
809 from pandas import Panel
810 except ImportError: # pandas>=1.2.0
811 Panel = None
812 Rolling, Expanding = None, None
813 try: # pandas>=1.0.0
814 from pandas.core.window.rolling import _Rolling_and_Expanding
815 except ImportError:
816 try: # pandas>=0.18.0
817 from pandas.core.window import _Rolling_and_Expanding
818 except ImportError: # pandas>=1.2.0
819 try: # pandas>=1.2.0
820 from pandas.core.window.expanding import Expanding
821 from pandas.core.window.rolling import Rolling
822 _Rolling_and_Expanding = Rolling, Expanding
823 except ImportError: # pragma: no cover
824 _Rolling_and_Expanding = None
825 try: # pandas>=0.25.0

Callers 2

tqdm_pandasFunction · 0.80
bells.pyFile · 0.80

Calls 2

copyMethod · 0.80
popMethod · 0.80

Tested by

no test coverage detected