Data Onboarding with Python

You are not restricted to using only the data available within Rasgo. You can easily upload data from a pandas data frame or a CSV.

If you have a pandas data frame you’d like to upload to Rasgo, use the following code:

source = rasgo.publish.source_data(source_type = 'dataframe', df = df, data_source_name = 'data source name')

This loads the dataframe into Rasgo as a source. You can find it in the GUI by clicking Sources on the left hand side.

And then finding the row for the source with that name

To create features from this source, use the following code

data_source_id = source.id dimensions = ['ZIPCODE', 'date'] features = ['min_DS_DAILY_HIGH_TEMP', 'max_DS_DAILY_HIGH_TEMP', 'mean_DS_DAILY_HIGH_TEMP', 'mean_rain'] granularity = ['day'] tags = ['onboarding'] feature_set_name = 'features from pandas' featureset = rasgo.publish.features_from_source( data_source_id = data_source_id, features = features, dimensions = dimensions, granularity = granularity, tags = tags, feature_set_name = feature_set_name) print('FeatureSet:', featureset)

Dimensions are columns from the data frame that Rasgo uses to join the features in this dataset with other datasets. Rasgo requires dimensions to have the same name in each feature set to allow this join to happen automatically.

Features are the list of columns in the data frame that you wish to import into Rasgo. Granularity is primarily used for geolocation and datetime dimensions to specify at what level the dimension operates - does a day dimension represent a daily record, weekly record, monthly record, etc. If you don’t have a datetime dimension, you can skip the granularity

Tags are optional notes that you can use to quickly find these features within the Rasgo app.

Then in the app, click on “Features” and select either the data source name under Data Sources

or, if you specified a unique tag (like done in the code snippet of “onboarding”) select that tag to see your features.

Next select details for each of those features to view the summary of the features you just uploaded to Rasgo.

See here for instructions on how to upload a CSV

Last updated