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

extract metadata #56

Closed
rashed120 opened this issue Oct 21, 2020 · 2 comments
Closed

extract metadata #56

rashed120 opened this issue Oct 21, 2020 · 2 comments

Comments

@rashed120
Copy link

Hi,

If i open xpt file in notepad, i can see column name there. Could you please guide me how can i extract column name form xpt file using xport?

@selik
Copy link
Owner

selik commented Oct 21, 2020

If you do this:

import xport.v56

with open('example.xpt', 'rb') as f:
    library = xport.v56.load(f)
help(library)

Do you get something that explains it?

@selik
Copy link
Owner

selik commented Oct 21, 2020

Sorry, I should have waited until I had a chance to write more. So, the load function parses a SAS dataset library, which can have many members. Each has a name, so the library is kind-of a dictionary of members. If you look at the library's keys, you'll see the member names. Pick out a member and it's a subclass of a Pandas DataFrame, the column names matching the SAS names.

@selik selik closed this as completed Dec 25, 2021
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

No branches or pull requests

2 participants