File tree 4 files changed +22
-29
lines changed
doc/source/getting_started/comparison
4 files changed +22
-29
lines changed Original file line number Diff line number Diff line change @@ -223,12 +223,7 @@ or more columns.
223
223
DATA step begins and can also be used in PROC statements */
224
224
run;
225
225
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
232
227
233
228
If/then logic
234
229
~~~~~~~~~~~~~
Original file line number Diff line number Diff line change @@ -73,24 +73,9 @@ Filtering in SQL is done via a WHERE clause.
73
73
74
74
SELECT *
75
75
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';
90
77
91
- is_dinner = tips[" time" ] == " Dinner"
92
- is_dinner.value_counts()
93
- tips[is_dinner].head(5 )
78
+ .. include :: filtering.rst
94
79
95
80
Just like SQL's OR and AND, multiple conditions can be passed to a DataFrame using | (OR) and &
96
81
(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.
217
217
218
218
list if total_bill > 10
219
219
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
226
221
227
222
If/then logic
228
223
~~~~~~~~~~~~~
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