Try to search your question here, if you can't find : Ask Any Question Now ?

SyntaxError remaining/shifting between lines in py file

HomeCategory: stackoverflowSyntaxError remaining/shifting between lines in py file
Avatarsourav asked 4 months ago

I have eight dataframes created with similar attributes except for source files/worksheets. At a line starting with ‘df3’ I am receiving a syntax error. The line starting with ‘df3’ is the same in structure as every other dataframe. If I comment block-out the line ‘df3’ the syntax error shifts to the next dataframe line below ‘df4’. If I comment block-out the line ‘df4’ the syntax error shifts to df5. What could be causing this type of error when the syntax is all the same and all but one dataframe is receiving the syntax error? I am using pydev in eclipse.

I’ve tried to place ‘#’ before various lines of code to try to eliminate the line with the error, but the syntax error moves to the next dataframe line.

 df3 = pd.read_excel(r'C:UsersSBFDesktopCodeSTATDataBook.xlsx', sheet_name = 'sheet_3', usecols = [0,2,3,5,6,9,10], header = 3)
 df4 = pd.read_excel(r'C:UsersSBFDesktopCodeSTATDataBook.xlsx', sheet_name = 'sheet_4', usecols = [0,2,3,5,6,9,10], header = 3)
 df5 = pd.read_excel(r'C:UsersSBFDesktopCodeSTATDataBook.xlsx', sheet_name = 'sheet_5', usecols = [0,2,3,5,6,9,10], header = 3)

error message ‘SyntaxError’ starts on line ‘df3’, then shifts to line ‘df4’ when ‘df3’ is blocked with ‘#’. shifts to line ‘df5’ when ‘df3’ and ‘df4’ are comment blocked with ‘#’ It doesn’t look like the syntax error is accurate because of the similar format of the lines of code and the fact that it is moving through lines of code without discrimination.

1 Answers
Best Answer
AvatarAmit answered 4 months ago
Your Answer

6 + 17 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com