adamerose / PandasGUI

A GUI for Pandas DataFrames
MIT No Attribution
3.18k stars 232 forks source link

support for xpt file #240

Open Yousuf28 opened 1 year ago

Yousuf28 commented 1 year ago

The SAS transport format (xpt) is a open format, as is required for submission of clinical and nonclinical data to the FDA. There are not many tools that support xpt file. At least, I don't know any open source tool (GUI) where you can open the xpt file and view the content. It would very helpful if PandasGUI support xpt file system. pandas package already have read_sas() function which convert xpt to pandas dataframe. Which makes it easy to integrate into PandasGUI. I was able to create executable file from PandasGUI, so this application can be distributed to non-programmer and they can open and view xpt file.

rjsdotorg commented 10 months ago

IMO that Export support for all formats that Pandas supports would be simple enough: to_sql, to_excel, to_json, to_parquet, etc

    def export_dialog(self):
        dialog = QtWidgets.QFileDialog()
        pgdf = self.store.selected_pgdf
        path, _ = dialog.getSaveFileName(directory=pgdf.name, filter="*.csv *.pkl *.sql *.xlsx *.json *.parquet")
        if path:
            filter_selected = os.path.splitext(path)[1][1:]
            if filter_selected=="csv":            
                pgdf.df.to_csv(path, index=False)
            elif filter_selected=="pkl":            
                pgdf.df.to_pickle(path)
            #elif filter_selected=="sql":   
            # needs a connection of course
            #    pgdf.df.to_sql(path, con=conx)
            elif filter_selected=="xlsx":            
                pgdf.df.to_excel(path, index=False)
            elif filter_selected=="json":            
                pgdf.df.to_json(path, orient='columns')
            elif filter_selected=="parquet":
                # no mixed types, ie: TypeError: an integer is required (got type str)
                pgdf.df.to_parquet(path)