4.42.1 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0] linux
``Can't add a custom information message such asset_postfixfor example when dealing with pandas dataframeprogress_apply` function.
#from tqdm.auto import tqdm
from tqdm import tqdm
import pandas as pd
df = pd.DataFrame(...)
tqdm.pandas(desc="customised", postfix={"hello": -1})
df.progress_apply(...)
tqdm.pandas(desc="remove postfix", postfix=None)
df.progress_apply(...)
I agree this is clunky but (kw)arguments to df.progress_apply are all passed to df.apply
#from tqdm.auto import tqdm from tqdm import tqdm import pandas as pd df = pd.DataFrame(...) tqdm.pandas(desc="customised", postfix={"hello": -1}) df.progress_apply(...) tqdm.pandas(desc="remove postfix", postfix=None) df.progress_apply(...)I agree this is clunky but (kw)arguments to
df.progress_applyare all passed todf.apply
Can I change the postfix string based on the iteration dynamically instead of having some fixed postfix ?
That's not exactly currently supported, and it wouldn't be easy to add without breaking backward compatibility.
The easiest approach would be explicitly defining a bar_format, e.g:
tqdm.pandas(
bar_format="{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}, iter={n}]")
df.progress_apply(...)
Cool, thank you so much for your help.
Most helpful comment
That's not exactly currently supported, and it wouldn't be easy to add without breaking backward compatibility.
The easiest approach would be explicitly defining a
bar_format, e.g: