#1798·tqdm

DataFrame.progress_map shows wrong total (number of columns) and freezes at 100%

Author: 2sumtechCreated Aug 19, 2026Updated Aug 19, 2026
  • I have marked all applicable categories:
    • exception-raising bug
    • visual output bug
  • I have visited the source website, and in particular read the known issues
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and environment, where applicable:
tqdm 4.70.0 (also reproduces on master 96f2e60)
pandas 3.0.5
Python 3.11.14
darwin

DataFrame.progress_map uses the number of columns as the bar total, although pandas' DataFrame.map (the pandas>=2.1 replacement for applymap) calls the function once per element (df.size times).

python
import time
import pandas as pd
from tqdm import tqdm

tqdm.pandas()
df = pd.DataFrame({'a': range(100), 'b': range(100), 'c': range(100)})
df.progress_map(lambda x: time.sleep(0.001) or x)

Actual: 100%|##########| 3/3 [00:00<00:00, 29.85it/s] — the bar reaches 100% after 3 of 300 calls (1% of the work) and stays frozen there, because the update wrapper stops counting once t.n == t.total.

Expected: 100%|##########| 300/300, matching what progress_applymap shows for the identical elementwise operation (total = df.size).

Root cause: in tqdm.std.tqdm.pandas, the total precompute only special-cases df_function == 'applymap'; 'map' (registered for DataFrame since 4.66.2) falls through to the row/column-count branch. Note progress_map is now the only elementwise option on pandas>=3.0, which removed applymap.

Happy to submit a PR (one-line fix + test update).