【问题标题】:Jupyter notebook running slow in Microsoft AzureJupyter 笔记本在 Microsoft Azure 中运行缓慢
【发布时间】:2021-11-29 15:54:10
【问题描述】:

我对使用 Microsoft Azure 运行 jupyter 笔记本很陌生。我注意到绘制 2 个 numpy 数组的极坐标图可能需要 30-45 秒,该数组相对较小(每个数组

【问题讨论】:

    标签: python azure jupyter-notebook azure-notebooks


    【解决方案1】:

    当数据加载限制很高时笔记本会变慢,下面是我遇到类似问题的情况之一。

    • 尝试显示大约 40000 列时,我遇到了一些严重的无响应问题和速度缓慢。
    • 我将代码更改为仅显示 40 或 80 列后,响应良好。

    以下是造成这种情况的一些根本原因:

    • 清理所有与熊猫等数据框相关的数据。

    • 从下面的块我们可以得到内存和cpu使用情况,这样可以帮助我们清除不需要的数据:

      #!/usr/bin/env python
      import psutil
      # gives a single float value
      psutil.cpu_percent()
      # gives an object with many fields
      psutil.virtual_memory()
      # you can convert that object to a dictionary 
      dict(psutil.virtual_memory()._asdict())
      # you can have the percentage of used RAM
      psutil.virtual_memory().percent
      79.2
      # you can calculate percentage of available memory
      psutil.virtual_memory().available * 100 / psutil.virtual_memory().total
      20.8
      
    • 我们将有一些变量检查器,如果启用它们,笔记本可能会因为熊猫等数据帧而变慢。 GIT Issue

      如果你想禁用它 --> 编辑 --> nbextensions 配置。

    有关详细说明,请参阅这些 SO(SO1SO2SO3SO4)链接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-07
      • 2016-11-04
      • 2016-10-26
      • 2020-05-17
      • 1970-01-01
      • 2018-09-23
      • 2020-11-18
      • 2021-07-12
      相关资源
      最近更新 更多