AttributeError: module 'pandas' has no attribute 'drop_duplicates'

AttributeError: module 'pandas' has no attribute 'drop_duplicates'

错误:“AttributeError:模块 'pandas' 没有属性 'drop_duplicates'” 这是一段工作正常的代码的新错误,有问题的代码:

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

有人知道会发生什么吗?非常感谢任何帮助!

谢谢

切换:

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

作者:

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