{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Pythonic VS String Syntax" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Import the LArray library:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from larray import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The LArray library offers two syntaxes to build axes and make selections and aggregations.\n", "The first one is more ``Pythonic`` (uses Python structures) \n", "For example, you can create an *age_category* axis as follows:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "age_category = Axis([\"0-9\", \"10-17\", \"18-66\", \"67+\"], \"age_category\")\n", "age_category" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The second one consists of using ``strings`` that are parsed.\n", "It is shorter to type. The same *age_category* axis could have been generated as follows:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "age_category = Axis(\"age_category=0-9,10-17,18-66,67+\")\n", "age_category" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "