Skip to content

wharton/sasdataframe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAS -> Pandas DataFrame

Installation

pip install sasdataframe

Usage

from sasdataframe import sas_to_dataframe

df = sas_to_dataframe('/path/to/sas/directory', 'dataset_name', '/path/to/file.csv')

This is just a wrapper around some SAS that exports the dataset in question to a csv. The /path/to/file.csv should be where you'd like the csv to live on the file system. This location will later be used to import the data into Pandas.

If you have opinions about what types your columns ought to have, you can pass in a dictionary where each key is the column name and each value is the desired data type.

type_dict = {'SYMBOL': object, 'NAME': object, 'CUSIP': object, 
             'first_available_date': object, 'last_available_date': object}

df = sas_to_dataframe('/path/to/sas/directory', 'dataset name', '/path/to/file.csv', type_dict=type_dict)

Dependencies

You'll want a copy of inlinesas installed for this one.

About

Import a SAS dataset into a Pandas dataframe

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages