python - python代码工作正常但exe抛出groupby错误
问题描述
我有一个问题,但不确定它是否与创建 exe 或其他东西有关。
我的 python 代码通过 pycharm 可以正常工作,但是当我从中运行 exe 文件时,它给了我错误:
Traceback (most recent call last):
'''
File "threading.py", line 917, in _bootstrap_inner
File "threading.py", line 865, in run
File "KPICompilation.py", line 49, in thread_function
df_by_date = merged_data.groupby("Date")
File "pandas\core\frame.py", line 6727, in groupby
File "pandas\core\groupby\groupby.py", line 568, in __init__
File "pandas\core\groupby\grouper.py", line 811, in get_grouper
KeyError: 'Date'
'''
我通过这个 cmd 创建了 exe 文件:
pyinstaller --additional-hooks-dir=. --onefile Compilation.py
这是引发错误的行:
df_by_date = merged_data.groupby("Date")
根据我对此的简短研究...我尝试过strip()
但似乎没有用
解决方案
推荐阅读
- sql - What databases support logarithmic prefix search?
- c# - 如何将 POST 请求正文中的有效 XML 提交到使用 XML 的 ASP.NET Core Web API?
- r - 如何在 [r] 中缺少值的数据中使用多个关系运算符为新变量赋值?
- ruby-on-rails - Why does Rails not recognize a *.js.coffee template?
- python - Iterate data structure while it is updated
- linux - Linux 设备树找不到在其正上方声明的元素
- python - No module named combo (from import wx.combo) - pyspread
- python - h5py causes jupyter to crash in for loop
- reactjs - npm ERR! missing script: jasmine
- regex - CSS表中的正则表达式