File tree Expand file tree Collapse file tree 4 files changed +22
-29
lines changed
doc/source/getting_started/comparison Expand file tree Collapse file tree 4 files changed +22
-29
lines changed Original file line number Diff line number Diff line change @@ -223,12 +223,7 @@ or more columns.
223223 DATA step begins and can also be used in PROC statements */
224224 run;
225225
226- DataFrames can be filtered in multiple ways; the most intuitive of which is using
227- :ref: `boolean indexing <indexing.boolean >`
228-
229- .. ipython :: python
230-
231- tips[tips[" total_bill" ] > 10 ].head()
226+ .. include :: filtering.rst
232227
233228If/then logic
234229~~~~~~~~~~~~~
Original file line number Diff line number Diff line change @@ -73,24 +73,9 @@ Filtering in SQL is done via a WHERE clause.
7373
7474 SELECT *
7575 FROM tips
76- WHERE time = 'Dinner'
77- LIMIT 5;
78-
79- DataFrames can be filtered in multiple ways; the most intuitive of which is using
80- :ref: `boolean indexing <indexing.boolean >`
81-
82- .. ipython :: python
83-
84- tips[tips[" time" ] == " Dinner" ].head(5 )
85-
86- The above statement is simply passing a ``Series `` of True/False objects to the DataFrame,
87- returning all rows with True.
88-
89- .. ipython :: python
76+ WHERE time = 'Dinner';
9077
91- is_dinner = tips[" time" ] == " Dinner"
92- is_dinner.value_counts()
93- tips[is_dinner].head(5 )
78+ .. include :: filtering.rst
9479
9580Just like SQL's OR and AND, multiple conditions can be passed to a DataFrame using | (OR) and &
9681(AND).
Original file line number Diff line number Diff line change @@ -217,12 +217,7 @@ Filtering in Stata is done with an ``if`` clause on one or more columns.
217217
218218 list if total_bill > 10
219219
220- DataFrames can be filtered in multiple ways; the most intuitive of which is using
221- :ref: `boolean indexing <indexing.boolean >`.
222-
223- .. ipython :: python
224-
225- tips[tips[" total_bill" ] > 10 ].head()
220+ .. include :: filtering.rst
226221
227222If/then logic
228223~~~~~~~~~~~~~
Original file line number Diff line number Diff line change 1+ :orphan:
2+
3+ DataFrames can be filtered in multiple ways; the most intuitive of which is using
4+ :ref: `boolean indexing <indexing.boolean >`
5+
6+ .. ipython :: python
7+
8+ tips[tips[" total_bill" ] > 10 ]
9+
10+ The above statement is simply passing a ``Series `` of ``True ``/``False `` objects to the DataFrame,
11+ returning all rows with ``True ``.
12+
13+ .. ipython :: python
14+
15+ is_dinner = tips[" time" ] == " Dinner"
16+ is_dinner
17+ is_dinner.value_counts()
18+ tips[is_dinner]
You can’t perform that action at this time.
0 commit comments