diff --git a/guide/english/data-science-tools/pandas/index.md b/guide/english/data-science-tools/pandas/index.md index 41273443a1..cb327ead20 100644 --- a/guide/english/data-science-tools/pandas/index.md +++ b/guide/english/data-science-tools/pandas/index.md @@ -45,11 +45,16 @@ df.tail() ``` This will show the last 5 rows of the data frame. -## Subsetting: Getting a column by name +## Subsetting A data frame can be subset in many ways. One of the simplest is getting a single column. For instance, if the data frame `df` contains a column named `age`, we can extract it as follows: ```python ages=df["age"] ``` +Another option for subsetting a dataframe is using the loc and iloc methods. The difference between loc and iloc is that loc searches based on a label and iloc searches based on the integer value of a row or column. To perform the same indexing as the above example using loc: +```python +ages=df.loc["age"] +``` + #### More Information: 1. [pandas](http://pandas.pydata.org/)