From d94420d96805f088df81f0975306b09ae83bcb60 Mon Sep 17 00:00:00 2001 From: Daniel Santos Date: Tue, 29 Oct 2019 22:08:31 +0100 Subject: [PATCH] Elucidate the use of filters (and, or). --- docs/tutorial.rst | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 2be7210..aa2d019 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -293,16 +293,26 @@ Let's tag some students. :: students.headers = ['first', 'last'] students.rpush(['Kenneth', 'Reitz'], tags=['male', 'technical']) + students.rpush(['Daniel', 'Dupont'], tags=['male', 'creative' ]) students.rpush(['Bessie', 'Monke'], tags=['female', 'creative']) -Now that we have extra meta-data on our rows, we can 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 Female students. :: + >>> students.filter(['female']).yaml + - {first: Bessie, Last: Monke} - >>> students.filter(['male']).yaml - - {first: Kenneth, Last: Reitz} +By default, when you pass a list of tags you get filter type or. :: + + >>> students.filter(['female', 'creative']).yaml + - {first: Daniel, Last: Dupont} + - {first: Bessie, Last: Monke} + +Using chaining you can get a filter type and. :: + + >>> students.filter(['female']).filter(['creative']).yaml + - {first: Bessie, Last: Monke} It's that simple. The original :class:`Dataset` is untouched. - Open an Excel Workbook and read first sheet -------------------------------------------