如何在 Jupyter 中为 Pandas 修复 tqdm progress_apply? [英] How to fix tqdm progress_apply for pandas in Jupyter?
问题描述
不太明白是错误还是只是我的本地问题,使用tqdm 进度条仍有一些问题 在 Jupyter 中使用 progress_apply.
Don't really understand is it a mistake or just my local problem, still have some issues with using tqdm progress bars with progress_apply in Jupyter.
第一次尝试:
from tqdm import tqdm
tqdm_notebook.pandas(desc="Example Desc")
keywords_df['keyword'] = keywords_df['keywird'].progress_apply(lambda x: x.replace('*',''))
输出(没有任何条):
AttributeError: 'function' object has no attribute 'pandas'
第二次尝试:
from tqdm import tqdm
tqdm_notebook().pandas(desc="Example Desc")
keywords_df['keyword'] = keywords_df['keywird'].progress_apply(lambda x: x.replace('*',''))
输出:两个酒吧(需要一个).第一个栏是空的(0it [00:00, ?it/s]),第二个是好的.
Output: Two bars (need one). First bar is empty (0it [00:00, ?it/s]), second is OK.
任何想法如何更改 progress_apply 描述和显示栏而不空的初始化栏?:)
Any ideas how to change progress_apply description and display bar without empty initialization bar? :)
附言文档(https://github.com/tqdm/tqdm)说我可以只使用 tqdm_notebook,但它对我不起作用:)
P.S. Documentation (https://github.com/tqdm/tqdm) says I can just use tqdm_notebook, but it's not working for me :)
# Register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm`
# (can use `tqdm_gui`, `tqdm_notebook`, optional kwargs, etc.)
tqdm.pandas(desc="my bar!")
推荐答案
回答来自tqdm 开发人员:
Answer from tqdm developer:
笔记本支持仍处于(后期)测试阶段.API 可能会改变当我们发布 tqdm v5 时稍微有点,但现在你可能需要
notebook support is still in a (late) beta stage. The API might change slightly when we release tqdm v5 but for now you probably need
from tqdm._tqdm_notebook import tqdm_notebook
tqdm_notebook.pandas(...
这篇关于如何在 Jupyter 中为 Pandas 修复 tqdm progress_apply?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!