<i id='P4SKx'><tr id='P4SKx'><dt id='P4SKx'><q id='P4SKx'><span id='P4SKx'><b id='P4SKx'><form id='P4SKx'><ins id='P4SKx'></ins><ul id='P4SKx'></ul><sub id='P4SKx'></sub></form><legend id='P4SKx'></legend><bdo id='P4SKx'><pre id='P4SKx'><center id='P4SKx'></center></pre></bdo></b><th id='P4SKx'></th></span></q></dt></tr></i><div id='P4SKx'><tfoot id='P4SKx'></tfoot><dl id='P4SKx'><fieldset id='P4SKx'></fieldset></dl></div>
      <tfoot id='P4SKx'></tfoot>

        <small id='P4SKx'></small><noframes id='P4SKx'>

      1. <legend id='P4SKx'><style id='P4SKx'><dir id='P4SKx'><q id='P4SKx'></q></dir></style></legend>
        • <bdo id='P4SKx'></bdo><ul id='P4SKx'></ul>

        无法使用 pandas 在 python3 中加载 csv 文件

        can#39;t load csv file in python3 with pandas(无法使用 pandas 在 python3 中加载 csv 文件)
          1. <i id='lO4gA'><tr id='lO4gA'><dt id='lO4gA'><q id='lO4gA'><span id='lO4gA'><b id='lO4gA'><form id='lO4gA'><ins id='lO4gA'></ins><ul id='lO4gA'></ul><sub id='lO4gA'></sub></form><legend id='lO4gA'></legend><bdo id='lO4gA'><pre id='lO4gA'><center id='lO4gA'></center></pre></bdo></b><th id='lO4gA'></th></span></q></dt></tr></i><div id='lO4gA'><tfoot id='lO4gA'></tfoot><dl id='lO4gA'><fieldset id='lO4gA'></fieldset></dl></div>

            <small id='lO4gA'></small><noframes id='lO4gA'>

              <tbody id='lO4gA'></tbody>
            <legend id='lO4gA'><style id='lO4gA'><dir id='lO4gA'><q id='lO4gA'></q></dir></style></legend>
              <bdo id='lO4gA'></bdo><ul id='lO4gA'></ul>

                1. <tfoot id='lO4gA'></tfoot>

                  本文介绍了无法使用 pandas 在 python3 中加载 csv 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  大家好,我不知道为什么,但是 pandas 确实无法在我的 python 代码中加载我的 csv 文件.该文件位于我的 python 项目的同一文件夹中,我正在使用 tensorflow、theano、pandas、numpy 和 matplotlib 库.已经 2 小时了,我尝试使用 pip3 命令卸载所有内容并再次重新安装.我卸载了 tensorflow、pandas、theano、numpy,甚至还卸载了 python2 和 python3.没有什么.我还更新和升级了我的 linux 发行版.无用.

                  Hi guys I don't know why but pandas really can't manage to load my csv file in my python code. The file is in the same folder of my python project, I'm working with tensorflow, theano, pandas, numpy and matplotlib libraries. It's been 2 hrs and I tried uninstalling everything and reinstalling once again using the pip3 commands. I uninstalled tensorflow, pandas, theano, numpy, and even python2 and python3. Nothing. I also updated and upgraded my linux distro. useless.

                  这是我在 Spyder3 内部终端中执行部分代码时不断遇到的错误:

                  this is the error I keep getting when I execute the part of my code in the Spyder3 internal terminal:

                      dataset = pd.read_csv('Churn_Modelling.csv')
                  Traceback (most recent call last):
                  
                    File "<ipython-input-4-610b2f33ea04>", line 1, in <module>
                      dataset = pd.read_csv('Churn_Modelling.csv')
                  
                    File "/usr/local/lib/python3.6/dist-packages/pandas/io/parsers.py", line 709, in parser_f
                      return _read(filepath_or_buffer, kwds)
                  
                    File "/usr/local/lib/python3.6/dist-packages/pandas/io/parsers.py", line 449, in _read
                      parser = TextFileReader(filepath_or_buffer, **kwds)
                  
                    File "/usr/local/lib/python3.6/dist-packages/pandas/io/parsers.py", line 818, in __init__
                      self._make_engine(self.engine)
                  
                    File "/usr/local/lib/python3.6/dist-packages/pandas/io/parsers.py", line 1049, in _make_engine
                      self._engine = CParserWrapper(self.f, **self.options)
                  
                    File "/usr/local/lib/python3.6/dist-packages/pandas/io/parsers.py", line 1695, in __init__
                      self._reader = parsers.TextReader(src, **kwds)
                  
                    File "pandas/_libs/parsers.pyx", line 402, in pandas._libs.parsers.TextReader.__cinit__
                  
                    File "pandas/_libs/parsers.pyx", line 718, in pandas._libs.parsers.TextReader._setup_parser_source
                  
                  FileNotFoundError: File b'Churn_Modelling.csv' does not exist
                  

                  这就是该死的代码行:

                  dataset = pd.read_csv('Churn_Modelling.csv')
                  

                  这有什么问题吗?我也尝试重命名它.

                  What is wrong with it guys?? I also tried to rename it.

                  推荐答案

                  错误信息是什么FileNotFoundError: File b'Churn_Modelling.csv' does not exist.如果文件存在,那么它不在你的 python 脚本的同一个工作目录中.

                  The error message is what it is FileNotFoundError: File b'Churn_Modelling.csv' does not exist. If the file exists, then it is not in the same working directory of your python script.

                  我会尝试打印当前工作目录来检查python是否在正确的目录中寻找文件.

                  I would try printing the current working directory to check whether python is looking for the file in the correct directory.

                  import os
                  print(os.getcwd())
                  

                  或者,您可以使用绝对路径,而不是使用相对路径(例如,Churn_Modelling.csv)导入文件

                  Alternatively, instead of importing the file using a relative path (e.g., Churn_Modelling.csv), you could use an absolute path

                  dataset = pd.read_csv('/path/to/file/Churn_Modelling.csv')
                  

                  另外,请注意在 POSIX 系统(例如,Linux/Mac)中,文件名区分大小写(即,Churn_Modellingchurn_modelling 不同).

                  Also, be mindful that in POSIX systems (e.g., Linux / Mac), the file name is case sensitive (i.e., Churn_Modelling is not the same as churn_modelling).

                  这篇关于无法使用 pandas 在 python3 中加载 csv 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                  Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                  python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                  Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                  How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                  Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)

                        <tbody id='mPydu'></tbody>
                      • <bdo id='mPydu'></bdo><ul id='mPydu'></ul>
                        <i id='mPydu'><tr id='mPydu'><dt id='mPydu'><q id='mPydu'><span id='mPydu'><b id='mPydu'><form id='mPydu'><ins id='mPydu'></ins><ul id='mPydu'></ul><sub id='mPydu'></sub></form><legend id='mPydu'></legend><bdo id='mPydu'><pre id='mPydu'><center id='mPydu'></center></pre></bdo></b><th id='mPydu'></th></span></q></dt></tr></i><div id='mPydu'><tfoot id='mPydu'></tfoot><dl id='mPydu'><fieldset id='mPydu'></fieldset></dl></div>

                          1. <small id='mPydu'></small><noframes id='mPydu'>

                            <tfoot id='mPydu'></tfoot>
                            <legend id='mPydu'><style id='mPydu'><dir id='mPydu'><q id='mPydu'></q></dir></style></legend>