Skip to content

Commit f33ab92

Browse files
committed
updated dotfmp conf notebook
1 parent e0a3e82 commit f33ab92

File tree

1 file changed

+72
-17
lines changed

1 file changed

+72
-17
lines changed

examples/conf_dotfmp_2018.ipynb

Lines changed: 72 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@
1616
"No need to worry about manually requesting access tokens, setting the right http headers, parsing responses, ..."
1717
]
1818
},
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {},
22+
"source": [
23+
"## Use cases"
24+
]
25+
},
26+
{
27+
"cell_type": "markdown",
28+
"metadata": {},
29+
"source": [
30+
"Some things you may use the python-fmrest library for:\n",
31+
"\n",
32+
"- Build a backend for a web app that works with FileMaker data\n",
33+
"- Use python-fmrest together with a rest framework to build your own data API as middleware \n",
34+
" (so that you don't expose the whole FM data API to a third party, but only allowed endpoints/actions)\n",
35+
"- Explore your FileMaker data with data analysis tools from the Python ecosystem\n",
36+
"- Anything else you could do in the past with the CWP/XML API"
37+
]
38+
},
1939
{
2040
"cell_type": "markdown",
2141
"metadata": {},
@@ -179,39 +199,40 @@
179199
]
180200
},
181201
{
182-
"cell_type": "markdown",
202+
"cell_type": "code",
203+
"execution_count": null,
183204
"metadata": {},
205+
"outputs": [],
184206
"source": [
185-
"Look at (some of) the moons of Jupiter (list records of a portal)"
207+
"type(planets), planets"
186208
]
187209
},
188210
{
189-
"cell_type": "code",
190-
"execution_count": null,
211+
"cell_type": "markdown",
191212
"metadata": {},
192-
"outputs": [],
193213
"source": [
194-
"record = fms.get_record(5, portals=[{'name': 'moons', 'limit': 5}])\n",
195-
"\n",
196-
"portal = record['portal_moons']\n",
197-
"portal"
214+
"Look at (some of) the moons of Jupiter (list records of a portal)"
198215
]
199216
},
200217
{
201218
"cell_type": "code",
202219
"execution_count": null,
203-
"metadata": {},
220+
"metadata": {
221+
"scrolled": true
222+
},
204223
"outputs": [],
205224
"source": [
206-
"for row in portal:\n",
207-
" print(row['Moons::name'])"
225+
"record = fms.get_record(5, portals=[{'name': 'moons', 'limit': 5}])\n",
226+
"\n",
227+
"portal = record['portal_moons']\n",
228+
"record, portal"
208229
]
209230
},
210231
{
211232
"cell_type": "markdown",
212233
"metadata": {},
213234
"source": [
214-
"Fetching a record always gives you a Record instance:"
235+
"Fetching a record always gives you a Record instance. The portal rows, however, are returned as a Foundset."
215236
]
216237
},
217238
{
@@ -220,7 +241,8 @@
220241
"metadata": {},
221242
"outputs": [],
222243
"source": [
223-
"record"
244+
"for row in portal:\n",
245+
" print(row['Moons::name'])"
224246
]
225247
},
226248
{
@@ -273,6 +295,13 @@
273295
"record.name, record['atmosphere']"
274296
]
275297
},
298+
{
299+
"cell_type": "markdown",
300+
"metadata": {},
301+
"source": [
302+
"So far we have seen Server, Foundset, Record. These are the main classes you need to be aware of when working with the library."
303+
]
304+
},
276305
{
277306
"cell_type": "markdown",
278307
"metadata": {},
@@ -458,6 +487,23 @@
458487
"Image(response.content)"
459488
]
460489
},
490+
{
491+
"cell_type": "markdown",
492+
"metadata": {},
493+
"source": [
494+
"## Exceptions"
495+
]
496+
},
497+
{
498+
"cell_type": "code",
499+
"execution_count": null,
500+
"metadata": {},
501+
"outputs": [],
502+
"source": [
503+
"find_request = [{'name': 'something that doesn\\'t exist'}]\n",
504+
"foundset = fms.find(query=find_request)"
505+
]
506+
},
461507
{
462508
"cell_type": "markdown",
463509
"metadata": {},
@@ -469,7 +515,7 @@
469515
"cell_type": "markdown",
470516
"metadata": {},
471517
"source": [
472-
"Turn Foundset into a Pandas DataFrame to analyse your dataset."
518+
"Turn Foundset into a Pandas DataFrame to do statistical analyses on your dataset, work with missing data, reshape/pivot, perform joins/merges, plot with matplotlib, export, etc."
473519
]
474520
},
475521
{
@@ -480,7 +526,16 @@
480526
"source": [
481527
"foundset = fms.get_records()\n",
482528
"df = foundset.to_df()\n",
483-
"df"
529+
"df.loc[:, df.columns != 'image']"
530+
]
531+
},
532+
{
533+
"cell_type": "code",
534+
"execution_count": null,
535+
"metadata": {},
536+
"outputs": [],
537+
"source": [
538+
"df[['name', 'atmosphere', 'rings', 'confirmed_moons', 'mass']].set_index('name').T"
484539
]
485540
},
486541
{
@@ -548,7 +603,7 @@
548603
"cell_type": "markdown",
549604
"metadata": {},
550605
"source": [
551-
"- **Examples**: https://github.com/davidhamann/python-fmrest/tree/master/examples\n",
606+
"- **More examples**: https://github.com/davidhamann/python-fmrest/tree/master/examples\n",
552607
"- GitHub: https://github.com/davidhamann/python-fmrest (MIT License)\n",
553608
"- v16 to v17 switch: https://davidhamann.de/2018/05/15/python-fmrest-and-filemaker-17-data-api/\n",
554609
"- Support and issues: https://github.com/davidhamann/python-fmrest/issues"

0 commit comments

Comments
 (0)