2

Im integrating a function into a python 2 code and it show a SyntaxError: invalid syntax at the parameters of the function thanks

here the function

def remove_federal_email_records(df_inv_file: pd.DataFrame,
                                 email_column: str,
                                 usf_master_file: str) -> pd.DataFrame:
    '''
    Remove records based on Federal domain emails.
    Records will be filtered using the US Federal e-mail master file.
    :param df_inv_file: A dataframe containing invite file data. It will be
    filtered using this function.
    :param column_name: The column which contains the email address.
    :param usf_master_file: The location of a .CSV file containing data with
    the US federal email domains in the first column.
    :returns: A pandas dataframe containing only the records with the approved
     countries.
    '''

and here the error message

bash: no job control in this shell
Traceback (most recent call last):
  File "/home/mesadmin/ucd-test-home/Offerings_ODS/python/OfferingWebAppHandler.py", line 18, in <module>
    import OfferingProcessInvite
  File "/home/mesadmin/ucd-test-home/Offerings_ODS/python/OfferingProcessInvite.py", line 324
    def remove_federal_email_records(df_inv_file: pd.DataFrame,
                                                ^
SyntaxError: invalid syntax

thanks for reading

  • 2
    Looks like you're using python 3 type annotations in python 2. have a look here: [type-hinting-in-python-2](https://stackoverflow.com/questions/35230635/type-hinting-in-python-2) – Will May 06 '20 at 22:29
  • thanks that helped, but since I'm trying to copy a python3 def into python 2 now I'm getting this error lol ''' INFO:OfferingProcessInvite:>>> Starting fixed_values function INFO:OfferingProcessInvite:>>> Starting fixed_values function INFO:OfferingProcessInvite:>>> Starting separate_records function ERROR:__main__:'module' object has no attribute 'dataframe' ''' – Kassandra Tafolla May 07 '20 at 16:12

0 Answers0