我在脚本中使用pandas模块.但是,每次运行脚本时,导入pandas需要3到10秒.我正在使用Python 2.7的Anaconda软件包,我没有遇到任何其他模块的问题.
我在一个单独的脚本上使用了cProfile,该脚本只包含一个'import Pandas'语句.输出的最高结果如下.
C:\Users\*****\AppData\Local\Continuum\Anaconda> python -m cProfile -s cumtime test_pandas_import.py
204229 function calls (199729 primitive calls) in 3.480 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
2 0.216 0.108 3.490 1.745 __init__.py:4(<module>)
1 0.019 0.019 3.482 3.482 test_imports.py:1(<module>)
19 0.155 0.008 1.300 0.068 __init__.py:1(<module>)
1 0.024 0.024 0.895 0.895 config_init.py:11(<module>)
1 0.049 0.049 0.803 0.803 __init__.py:106(<module>)
1 0.024 0.024 0.669 0.669 format.py:2(<module>)
1 0.005 0.005 0.628 0.628 add_newdocs.py:10(<module>)
2 0.029 0.015 0.604 0.302 index.py:2(<module>)
2 0.094 …Run Code Online (Sandbox Code Playgroud)