Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for xpt file #240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Yousuf28
Copy link

@Yousuf28 Yousuf28 commented Oct 2, 2023

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
Copy link

rjsdotorg commented Dec 7, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants