Ad

Wednesday, March 21, 2018

Difference between iloc and loc in Pandas

ix is deprecated, use of iloc and loc are encouraged.

.loc for label based indexing or
.iloc for positional indexing

Useful for querying row data
df.head(5)
df.loc[0:5]
Also powerful for column based querying
df_pro_desc.loc[0:2,["col_1", "col_2"]]

No comments:

Post a Comment

Reinforcement Learning Q Learning

Explore <s, a> ---> s' reads: move from current state s to s' via action a.   Through the action a reward  is received, it ...