File tree Expand file tree Collapse file tree 1 file changed +36
-10
lines changed Expand file tree Collapse file tree 1 file changed +36
-10
lines changed Original file line number Diff line number Diff line change @@ -128,11 +128,15 @@ each Tuple in a catalog's index, which follows the link to the Entity resource:
128
128
}
129
129
})
130
130
131
+ ### Creating a New Dataset
132
+
131
133
You typically add new resources to a Catalog via its ` create ` method:
132
134
133
135
>>> ds = site.datasets.create({"body": {
134
- 'name': "My first dataset"
135
- }}, refresh=True)
136
+ "name": "My first dataset",
137
+ "project": "https://your-domain.crunch.io/api/projects/dbf9foo7b727/"
138
+ }})
139
+ >>> ds.refresh()
136
140
>>> gender = ds.variables.create({"body": {
137
141
'name': 'Gender',
138
142
'alias': 'gender',
@@ -143,15 +147,37 @@ You typically add new resources to a Catalog via its `create` method:
143
147
{'id': 2, 'name': 'F', 'numeric_value': None, 'missing': False}
144
148
],
145
149
'values': [1, 2, {"?": -1}, 2]
146
- }}, refresh=True )
147
- >>> print(ds.table.data )
150
+ }})
151
+ >>> print(ds.table.metadata )
148
152
pycrunch.elements.JSONObject(**{
149
- "e7f361628": [
150
- 1,
151
- 2,
152
- {"?": -1},
153
- 2
154
- ]
153
+ "dbebef213d3d413398f0c4075acb05a7": {
154
+ "alias": "gender",
155
+ "name": "Gender",
156
+ "type": "categorical",
157
+ "description": "",
158
+ "notes": "",
159
+ "derived": false,
160
+ "categories": [
161
+ {
162
+ "missing": true,
163
+ "numeric_value": null,
164
+ "id": -1,
165
+ "name": "No Data"
166
+ },
167
+ {
168
+ "missing": false,
169
+ "numeric_value": null,
170
+ "id": 1,
171
+ "name": "M"
172
+ },
173
+ {
174
+ "missing": false,
175
+ "numeric_value": null,
176
+ "id": 2,
177
+ "name": "F"
178
+ }
179
+ ]
180
+ }
155
181
})
156
182
157
183
To access a Pandas Dataframe of the data in your dataset:
You can’t perform that action at this time.
0 commit comments