0

The error: "AttributeError: module 'pandas' has no attribute 'drop_duplicates'" This is a new error on a section of code that has been working fine, the code in question:

def The_function():
   file = os.getcwd() + "the_file.xls"
   xls = pd.ExcelFile(file)
   the_sheets = []
   for sheet in xls.sheet_names:
      the_sheets.append(xls.parse(sheet))
   result = pd.concat(the_sheets)
   result = pd.drop_duplicates(subset='Trade ID', keep="first")
   return results

Does anyone have any ideas as to what might be happening? greatly appreciate any help!

Thank you

11l
  • 73
  • 1
  • 9

1 Answers1

1

Switch:

result = pd.drop_duplicates(subset='Trade ID', keep="first")

By:

result = result.drop_duplicates(subset='Trade ID', keep="first")
Niv Dudovitch
  • 1,614
  • 7
  • 15