adamerose / PandasGUI

A GUI for Pandas DataFrames
MIT No Attribution
3.17k stars 229 forks source link

Add more file type export options to GUI.py #158

Open rjsdotorg opened 3 years ago

rjsdotorg commented 3 years ago

Since PG allows modifications and joins, I wanted to re-save the pickles. In GUI.py at 351, I simply added more options.

    def export_dialog(self):
        dialog = QtWidgets.QFileDialog()
        pgdf = self.store.selected_pgdf
        path, _ = dialog.getSaveFileName(directory=pgdf.name, filter="CSV (*.csv);;Python files (*.pkl *.hdf *.sql)")
        if path:
            if path[-3:]== 'csv':
                pgdf.df.to_csv(path, index=False)
            elif path[-3:]== 'pkl':
                pgdf.df.to_pickle(path)
            elif path[-3:]== 'hdf':
                pgdf.df.to_hdf(path)
            elif path[-3:]== 'sql':
                pgdf.df.to_sql(path)