Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
y = dict["Y Variable"][0]
c = dict["Color By"][0]
except IndexError:
c = None
sns.scatterplot(x, y, c, data=df)
plt.show()
if __name__ == "__main__":
import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
test = Dragger(sources=["a", "b"], destinations=["x", "y", "z"])
test.show()
sys.exit(app.exec_())
def makePicker(self):
self.layout.removeWidget(self.picker)
self.df[self.column_name].astype(str).unique()
self.picker = Dragger(
self.names.text().split(","), self.df[self.column_name].astype(str).unique()
)
print(self.df[self.column_name].astype(str).unique())
self.layout.addWidget(self.picker)
def __init__(self, df, column):
super().__init__()
self.layout = QtWidgets.QVBoxLayout()
self.setLayout(self.layout)
self.df = df
from pandasgui import show
self.column_name = column
self.names = QtWidgets.QLineEdit()
self.names.textChanged.connect(self.makePicker)
self.picker = Dragger(["col1", "col2", "col3"], df[column].astype(str).unique())
# Add button
btnFinish = QtWidgets.QPushButton("Finish")
btnFinish.clicked.connect(self.finish)
btnReset = QtWidgets.QPushButton("Reset")
btnReset.clicked.connect(self.finish)
buttonLayout = QtWidgets.QHBoxLayout()
spacer = QtWidgets.QSpacerItem(
0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum
)
buttonLayout.addSpacerItem(spacer)
buttonLayout.addWidget(btnReset)
buttonLayout.addWidget(btnFinish)
# Add all to layout
self.layout.addLayout(buttonLayout)
def __init__(
self, dataframes, destination_names, title, parent=None, default_df=None
):
super().__init__(parent)
self.dataframes = dataframes
self.setWindowTitle(title)
layout = QtWidgets.QVBoxLayout()
self.setLayout(layout)
# Create column picker
self.columnPicker = Dragger(destination_names=destination_names)
# Create DataFrame picker dropdown
self.dataframePicker = QtWidgets.QComboBox()
# Fill the dataframe picker with the names of dataframes
for df_name in dataframes.keys():
self.dataframePicker.addItem(df_name)
# Set default selection and trigger currentIndexChanged
index = self.dataframePicker.findText(default_df)
if index != -1:
self.dataframePicker.setCurrentIndex(index)
else:
self.dataframePicker.setCurrentIndex(0)
self.dataframeChanged()
# Connect signals