Pandas throws ParserError on one computer but not on another












1















Here's the code I have, which works perfectly fine on my friend's computer:



#!/usr/bin/python

import pandas as pd

df = pd.read_csv("report.csv")
df = df.drop("Agent Name", axis=1)
df.to_csv("agent_report_updated.csv")


Here's the error I receive on mine:



Traceback (most recent call last):
File "./agent_calls_report.py", line 10, in <module>
df = pd.read_csv("report.csv")
File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 678, in parser_f
return _read(filepath_or_buffer, kwds)
File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 446, in _read
data = parser.read(nrows)
File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 1036, in read
ret = self._engine.read(nrows)
File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 1848, in read
data = self._reader.read(nrows)
File "pandas/_libs/parsers.pyx", line 876, in pandas._libs.parsers.TextReader.read
File "pandas/_libs/parsers.pyx", line 891, in pandas._libs.parsers.TextReader._read_low_memory
File "pandas/_libs/parsers.pyx", line 945, in pandas._libs.parsers.TextReader._read_rows
File "pandas/_libs/parsers.pyx", line 932, in pandas._libs.parsers.TextReader._tokenize_rows
File "pandas/_libs/parsers.pyx", line 2112, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Expected 34 fields in line 3, saw 35


Any idea why this would work on one computer and not another? Edit: I've confirmed that we are using the same versions of both Python (3.7.1) and Pandas, the only difference is that he has a Mac while I'm on Linux.










share|improve this question



























    1















    Here's the code I have, which works perfectly fine on my friend's computer:



    #!/usr/bin/python

    import pandas as pd

    df = pd.read_csv("report.csv")
    df = df.drop("Agent Name", axis=1)
    df.to_csv("agent_report_updated.csv")


    Here's the error I receive on mine:



    Traceback (most recent call last):
    File "./agent_calls_report.py", line 10, in <module>
    df = pd.read_csv("report.csv")
    File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 678, in parser_f
    return _read(filepath_or_buffer, kwds)
    File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 446, in _read
    data = parser.read(nrows)
    File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 1036, in read
    ret = self._engine.read(nrows)
    File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 1848, in read
    data = self._reader.read(nrows)
    File "pandas/_libs/parsers.pyx", line 876, in pandas._libs.parsers.TextReader.read
    File "pandas/_libs/parsers.pyx", line 891, in pandas._libs.parsers.TextReader._read_low_memory
    File "pandas/_libs/parsers.pyx", line 945, in pandas._libs.parsers.TextReader._read_rows
    File "pandas/_libs/parsers.pyx", line 932, in pandas._libs.parsers.TextReader._tokenize_rows
    File "pandas/_libs/parsers.pyx", line 2112, in pandas._libs.parsers.raise_parser_error
    pandas.errors.ParserError: Error tokenizing data. C error: Expected 34 fields in line 3, saw 35


    Any idea why this would work on one computer and not another? Edit: I've confirmed that we are using the same versions of both Python (3.7.1) and Pandas, the only difference is that he has a Mac while I'm on Linux.










    share|improve this question

























      1












      1








      1








      Here's the code I have, which works perfectly fine on my friend's computer:



      #!/usr/bin/python

      import pandas as pd

      df = pd.read_csv("report.csv")
      df = df.drop("Agent Name", axis=1)
      df.to_csv("agent_report_updated.csv")


      Here's the error I receive on mine:



      Traceback (most recent call last):
      File "./agent_calls_report.py", line 10, in <module>
      df = pd.read_csv("report.csv")
      File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 678, in parser_f
      return _read(filepath_or_buffer, kwds)
      File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 446, in _read
      data = parser.read(nrows)
      File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 1036, in read
      ret = self._engine.read(nrows)
      File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 1848, in read
      data = self._reader.read(nrows)
      File "pandas/_libs/parsers.pyx", line 876, in pandas._libs.parsers.TextReader.read
      File "pandas/_libs/parsers.pyx", line 891, in pandas._libs.parsers.TextReader._read_low_memory
      File "pandas/_libs/parsers.pyx", line 945, in pandas._libs.parsers.TextReader._read_rows
      File "pandas/_libs/parsers.pyx", line 932, in pandas._libs.parsers.TextReader._tokenize_rows
      File "pandas/_libs/parsers.pyx", line 2112, in pandas._libs.parsers.raise_parser_error
      pandas.errors.ParserError: Error tokenizing data. C error: Expected 34 fields in line 3, saw 35


      Any idea why this would work on one computer and not another? Edit: I've confirmed that we are using the same versions of both Python (3.7.1) and Pandas, the only difference is that he has a Mac while I'm on Linux.










      share|improve this question














      Here's the code I have, which works perfectly fine on my friend's computer:



      #!/usr/bin/python

      import pandas as pd

      df = pd.read_csv("report.csv")
      df = df.drop("Agent Name", axis=1)
      df.to_csv("agent_report_updated.csv")


      Here's the error I receive on mine:



      Traceback (most recent call last):
      File "./agent_calls_report.py", line 10, in <module>
      df = pd.read_csv("report.csv")
      File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 678, in parser_f
      return _read(filepath_or_buffer, kwds)
      File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 446, in _read
      data = parser.read(nrows)
      File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 1036, in read
      ret = self._engine.read(nrows)
      File "/usr/lib/python3.7/site-packages/pandas/io/parsers.py", line 1848, in read
      data = self._reader.read(nrows)
      File "pandas/_libs/parsers.pyx", line 876, in pandas._libs.parsers.TextReader.read
      File "pandas/_libs/parsers.pyx", line 891, in pandas._libs.parsers.TextReader._read_low_memory
      File "pandas/_libs/parsers.pyx", line 945, in pandas._libs.parsers.TextReader._read_rows
      File "pandas/_libs/parsers.pyx", line 932, in pandas._libs.parsers.TextReader._tokenize_rows
      File "pandas/_libs/parsers.pyx", line 2112, in pandas._libs.parsers.raise_parser_error
      pandas.errors.ParserError: Error tokenizing data. C error: Expected 34 fields in line 3, saw 35


      Any idea why this would work on one computer and not another? Edit: I've confirmed that we are using the same versions of both Python (3.7.1) and Pandas, the only difference is that he has a Mac while I'm on Linux.







      python python-3.x pandas






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 28 '18 at 23:29









      Some Dude From the InternetSome Dude From the Internet

      246




      246
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I believe this is a problem with encoding



          try this :



          import pandas as pd
          df = pd.read_csv("report.csv",encoding='cp1252')
          df = df.drop("Agent Name", axis=1)
          df.to_csv("agent_report_updated.csv")


          There are other encoding options you can try utf-8 instead of cp1252.
          Here is a list of encodings used.






          share|improve this answer
























          • Appreciate the answer, but it doesn't look like that resolved it. I'm starting to think this is either a bug with Pandas, or something changed in 3.7.1 that's breaking the interaction. I tried this using 3.7.0 and it worked okay.

            – Some Dude From the Internet
            Nov 28 '18 at 23:49






          • 1





            I see, did you try applying some of the answers here ?stackoverflow.com/questions/18039057/…

            – Aditya Lahiri
            Nov 28 '18 at 23:53













          • I had tried a few, but the comment there about deleting a particular column ended up being the correct answer. Thank you for your help!

            – Some Dude From the Internet
            Nov 29 '18 at 0:03











          • That sounds good.

            – Aditya Lahiri
            Nov 29 '18 at 0:05












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53529678%2fpandas-throws-parsererror-on-one-computer-but-not-on-another%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I believe this is a problem with encoding



          try this :



          import pandas as pd
          df = pd.read_csv("report.csv",encoding='cp1252')
          df = df.drop("Agent Name", axis=1)
          df.to_csv("agent_report_updated.csv")


          There are other encoding options you can try utf-8 instead of cp1252.
          Here is a list of encodings used.






          share|improve this answer
























          • Appreciate the answer, but it doesn't look like that resolved it. I'm starting to think this is either a bug with Pandas, or something changed in 3.7.1 that's breaking the interaction. I tried this using 3.7.0 and it worked okay.

            – Some Dude From the Internet
            Nov 28 '18 at 23:49






          • 1





            I see, did you try applying some of the answers here ?stackoverflow.com/questions/18039057/…

            – Aditya Lahiri
            Nov 28 '18 at 23:53













          • I had tried a few, but the comment there about deleting a particular column ended up being the correct answer. Thank you for your help!

            – Some Dude From the Internet
            Nov 29 '18 at 0:03











          • That sounds good.

            – Aditya Lahiri
            Nov 29 '18 at 0:05
















          0














          I believe this is a problem with encoding



          try this :



          import pandas as pd
          df = pd.read_csv("report.csv",encoding='cp1252')
          df = df.drop("Agent Name", axis=1)
          df.to_csv("agent_report_updated.csv")


          There are other encoding options you can try utf-8 instead of cp1252.
          Here is a list of encodings used.






          share|improve this answer
























          • Appreciate the answer, but it doesn't look like that resolved it. I'm starting to think this is either a bug with Pandas, or something changed in 3.7.1 that's breaking the interaction. I tried this using 3.7.0 and it worked okay.

            – Some Dude From the Internet
            Nov 28 '18 at 23:49






          • 1





            I see, did you try applying some of the answers here ?stackoverflow.com/questions/18039057/…

            – Aditya Lahiri
            Nov 28 '18 at 23:53













          • I had tried a few, but the comment there about deleting a particular column ended up being the correct answer. Thank you for your help!

            – Some Dude From the Internet
            Nov 29 '18 at 0:03











          • That sounds good.

            – Aditya Lahiri
            Nov 29 '18 at 0:05














          0












          0








          0







          I believe this is a problem with encoding



          try this :



          import pandas as pd
          df = pd.read_csv("report.csv",encoding='cp1252')
          df = df.drop("Agent Name", axis=1)
          df.to_csv("agent_report_updated.csv")


          There are other encoding options you can try utf-8 instead of cp1252.
          Here is a list of encodings used.






          share|improve this answer













          I believe this is a problem with encoding



          try this :



          import pandas as pd
          df = pd.read_csv("report.csv",encoding='cp1252')
          df = df.drop("Agent Name", axis=1)
          df.to_csv("agent_report_updated.csv")


          There are other encoding options you can try utf-8 instead of cp1252.
          Here is a list of encodings used.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 28 '18 at 23:46









          Aditya LahiriAditya Lahiri

          1937




          1937













          • Appreciate the answer, but it doesn't look like that resolved it. I'm starting to think this is either a bug with Pandas, or something changed in 3.7.1 that's breaking the interaction. I tried this using 3.7.0 and it worked okay.

            – Some Dude From the Internet
            Nov 28 '18 at 23:49






          • 1





            I see, did you try applying some of the answers here ?stackoverflow.com/questions/18039057/…

            – Aditya Lahiri
            Nov 28 '18 at 23:53













          • I had tried a few, but the comment there about deleting a particular column ended up being the correct answer. Thank you for your help!

            – Some Dude From the Internet
            Nov 29 '18 at 0:03











          • That sounds good.

            – Aditya Lahiri
            Nov 29 '18 at 0:05



















          • Appreciate the answer, but it doesn't look like that resolved it. I'm starting to think this is either a bug with Pandas, or something changed in 3.7.1 that's breaking the interaction. I tried this using 3.7.0 and it worked okay.

            – Some Dude From the Internet
            Nov 28 '18 at 23:49






          • 1





            I see, did you try applying some of the answers here ?stackoverflow.com/questions/18039057/…

            – Aditya Lahiri
            Nov 28 '18 at 23:53













          • I had tried a few, but the comment there about deleting a particular column ended up being the correct answer. Thank you for your help!

            – Some Dude From the Internet
            Nov 29 '18 at 0:03











          • That sounds good.

            – Aditya Lahiri
            Nov 29 '18 at 0:05

















          Appreciate the answer, but it doesn't look like that resolved it. I'm starting to think this is either a bug with Pandas, or something changed in 3.7.1 that's breaking the interaction. I tried this using 3.7.0 and it worked okay.

          – Some Dude From the Internet
          Nov 28 '18 at 23:49





          Appreciate the answer, but it doesn't look like that resolved it. I'm starting to think this is either a bug with Pandas, or something changed in 3.7.1 that's breaking the interaction. I tried this using 3.7.0 and it worked okay.

          – Some Dude From the Internet
          Nov 28 '18 at 23:49




          1




          1





          I see, did you try applying some of the answers here ?stackoverflow.com/questions/18039057/…

          – Aditya Lahiri
          Nov 28 '18 at 23:53







          I see, did you try applying some of the answers here ?stackoverflow.com/questions/18039057/…

          – Aditya Lahiri
          Nov 28 '18 at 23:53















          I had tried a few, but the comment there about deleting a particular column ended up being the correct answer. Thank you for your help!

          – Some Dude From the Internet
          Nov 29 '18 at 0:03





          I had tried a few, but the comment there about deleting a particular column ended up being the correct answer. Thank you for your help!

          – Some Dude From the Internet
          Nov 29 '18 at 0:03













          That sounds good.

          – Aditya Lahiri
          Nov 29 '18 at 0:05





          That sounds good.

          – Aditya Lahiri
          Nov 29 '18 at 0:05




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53529678%2fpandas-throws-parsererror-on-one-computer-but-not-on-another%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks