0

I'm running python 2.7 and trying to get program working with pandas. The following error message is received when importing Column. Looks like it might be an issue with the :-

def __init__(self, name: str, validations: typing.Iterable['validation._BaseValidation'] = [], allow_empty=False):

Error Message:

File "/Users/coxda/faDataValidation27/lib/python2.7/site-packages/pandas_schema/column.py", line 8 def init(self, name: str, validations: typing.Iterable['validation._BaseValidation'] = [], allow_empty=False): ^ SyntaxError: invalid syntax

anoopknr
  • 3,177
  • 2
  • 23
  • 33
D Cox
  • 3
  • 1

1 Answers1

0

The syntax error is because the package uses Python 3.5's type annotation: https://docs.python.org/3/library/typing.html

The package documentation does not specifically mention Python 3 is required, but the syntax it uses suggests Python 3.5+ is required, or, since the package is in pure python, you could edit the column.py source and should be able to remove those type annotations and then successfully import the classes.

Reference: What is the colon inside the parameter mean in python? [duplicate]

  • Thanks. Yes it is working when I run with Python 3.6.5. Looks like a documentation error since it doesn't work on 2.7 – D Cox Jul 20 '18 at 22:24