Skip to content

Commit 4c66e3f

Browse files
author
Susan Vanderplas
committed
More precise pandas stuff
1 parent 5229a04 commit 4c66e3f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

part-gen-prog/03-data-struct.qmd

+3-1
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,12 @@ digits_pi[2]
253253
```{python series-pandas-2, error = T}
254254
# Python is 0 indexed - a list of 11 things goes from 0 to 10
255255
digits_pi[0]
256-
digits_pi[11]
256+
digits_pi[11] # This errors out
257257
258258
# logical indexing works here too
259259
digits_pi[digits_pi > 3]
260+
digits_pi.loc[digits_pi > 3]
261+
260262
# simple multiplication works in a vectorized manner
261263
# that is, the whole vector is multiplied at once
262264
digits_pi * 2

0 commit comments

Comments
 (0)