【问题标题】:Newline created after each iteration每次迭代后创建的换行符
【发布时间】:2018-11-21 22:50:14
【问题描述】:

我在 Jupyter 笔记本上使用 tqdm 和 Pandas。

我有一个 Pandas 数据框 df。 当我使用df.progress_apply 时,会打印新行而不是只更新一行。

这是我目前所做的:

tqdm.pandas(desc="Computing MONTH...")
df["MONTH"] = df.progress_apply(compute_month, axis=1)

我的问题不是这个问题的重复:tqdm in Jupyter Notebook

因为他们说使用tqdm_notebook 而不是tqdm。 我不能使用tqdm_notebook,因为我需要实现df.progress_apply

由于我的代码太重,我无法在最小示例中重现此问题。

这是 Github 中与此问题相关但无法帮助我的问题:https://github.com/tqdm/tqdm/issues/375

【问题讨论】:

    标签: python pandas jupyter-notebook tqdm


    【解决方案1】:

    你应该这样做:

    from tqdm import tqdm_notebook
    tqdm_notebook().pandas()
    

    这样就可以了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-22
      • 2017-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-10
      • 2013-12-18
      相关资源
      最近更新 更多