Skip to content

Commit 8f6bbe0

Browse files
committed
Move example code into block
1 parent b8f5ae2 commit 8f6bbe0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

episodes/07-pandas_essential.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ or:
128128
print(df.iloc[0, :])
129129
```
130130

131-
Note that here we knew that Albania was the first country in the DataFrame, so we were able to ask for the first column (0). If you needed to know the column ID for a particular country, you could do this using `get_loc()`, e.g. `data.index.get_loc("France")` should tell you the column ID value for France.
131+
Note that here we knew that Albania was the first country in the DataFrame, so we were able to ask for the first column (0). If you needed to know the column ID for a particular country, you could do this using `get_loc()`, e.g. to get the column ID value for France:
132+
133+
```python
134+
df.index.get_loc("France")
135+
```
132136

133137
The `:` character by itself is shorthand to indicate all elements across that index, but it can also be combined with index values or column headers to specify a slice of the DataArray:
134138

0 commit comments

Comments
 (0)