Menú desplegable para Qheaderview Python

  self.tableView.horizontalHeader().sectionClicked.connect(self.headerClicked) 
  
  def headerClicked(self, index):
        self.columnIndex = index
        menu = QMenu(self)
        menuItems = list(dict.fromkeys(df.iloc[:, index].tolist())) # list from selected column and drop duplicates
        for item in menuItems:
            action = QAction(str(item), self)	# str(item) - init action title
            action.setData(item)		# init action value
            action.triggered.connect(self.itemClicked)
            menu.addAction(action)
        headerPos = self.tableView.mapToGlobal(self.tableView.horizontalHeader().pos())
        posY = headerPos.y() + self.tableView.horizontalHeader().height()
        posX = headerPos.x() + self.tableView.horizontalHeader().sectionViewportPosition(index)
        menu.exec_(QPoint(posX, posY))

    def itemClicked(self):
    	action = self.sender()
        print("Filtering column {}".format(self.columnIndex), action.data())
        # implement your need
Tomer Mantzuri