diff options
| author | Kenneth Reitz <me@kennethreitz.com> | 2014-05-27 12:51:30 -0400 |
|---|---|---|
| committer | Kenneth Reitz <me@kennethreitz.com> | 2014-05-27 12:51:30 -0400 |
| commit | c5972db8f0fe006aba6c2069ae9f5936a2d3d206 (patch) | |
| tree | 7d6a7961d544c960fadbc3f5bcd4d392167d9fc0 /docs/tutorial.rst | |
| parent | 2bc6122ee8a69b70a686e47876658cdd8a835be6 (diff) | |
| parent | 1cc051f3e881289a8b51133c0c1ee73683b2d6fc (diff) | |
| download | tablib-c5972db8f0fe006aba6c2069ae9f5936a2d3d206.tar.gz | |
Merge branch 'develop'
Diffstat (limited to 'docs/tutorial.rst')
| -rw-r--r-- | docs/tutorial.rst | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 561b24c..bd2dbc0 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -68,7 +68,7 @@ Adding Headers -------------- -It's time enhance our :class:`Dataset` by giving our columns some titles. To do so, set :class:`Dataset.headers`. :: +It's time to enhance our :class:`Dataset` by giving our columns some titles. To do so, set :class:`Dataset.headers`. :: data.headers = ['First Name', 'Last Name'] @@ -146,6 +146,13 @@ To do so, we access the :class:`Dataset` as if it were a standard Python diction >>> data['First Name'] ['Kenneth', 'Bessie'] +You can also access the column using its index. :: + + >>> d.headers + ['Last Name', 'First Name', 'Age'] + >>> d.get_col(1) + ['Kenneth', 'Bessie'] + Let's find the average age. :: >>> ages = data['Age'] @@ -244,7 +251,7 @@ Filtering Datasets with Tags When constructing a :class:`Dataset` object, you can add tags to rows by specifying the ``tags`` parameter. -This allows you to filter your :class:`Dataset` later. This can be useful so separate rows of data based on +This allows you to filter your :class:`Dataset` later. This can be useful to separate rows of data based on arbitrary criteria (*e.g.* origin) that you don't want to include in your :class:`Dataset`. Let's tag some students. :: @@ -256,7 +263,7 @@ Let's tag some students. :: students.rpush(['Kenneth', 'Reitz'], tags=['male', 'technical']) students.rpush(['Bessie', 'Monke'], tags=['female', 'creative']) -Now that we have extra meta-data on our rows, we can use easily filter our :class:`Dataset`. Let's just see Male students. :: +Now that we have extra meta-data on our rows, we can easily filter our :class:`Dataset`. Let's just see Male students. :: >>> students.filter(['male']).yaml |
