Search code examples
pythonpandasjupyter-notebooktext-filesvi

pandas.read_table working in Jupyter notebook but would not work in vi editor


I am trying to read txt file containing the table with pandas.read_table by executing the following code.

I added import pandas as pd and the problematic code is pstttable=read_table("pstttable.txt").

Obviously, the location of the txt file is correct and the same code works when working with Jupyter notebook from Windows.

However, I want to compile the code with .py file edited by vi editor from Linux terminal and the following error will occur.

File "Global_Repeater_Search.py", line 22 pstttable=pd.read_table("/Users/sgtsnu02/2019-2020_Intern/EQcorrscan/pstttable.txt") ^ SyntaxError: invalid syntax

I have no idea why this kind of error occurs. Is this problem inherent to pandas when working in Linux terminal?


Solution

  • This was really stupid question. I forgot to close parentheses of the line before pstttable=pd.read_table("/Users/sgtsnu02/2019-2020_Intern/EQcorrscan/pstttable.txt").

    This caused SyntaxError: invalid syntax.

    Nothing is wrong with vi nor pandas.read_table.