Skip to content

Instantly share code, notes, and snippets.

@shanealynn
Last active November 29, 2022 11:29
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanealynn/1efd0555a0a668b5f0e3f5fa5593c673 to your computer and use it in GitHub Desktop.
Save shanealynn/1efd0555a0a668b5f0e3f5fa5593c673 to your computer and use it in GitHub Desktop.
# Single selections using iloc and DataFrame
# Rows:
data.iloc[0] # first row of data frame (Aleshia Tomkiewicz) - Note a Series data type output.
data.iloc[1] # second row of data frame (Evan Zigomalas)
data.iloc[-1] # last row of data frame (Mi Richan)
# Columns:
data.iloc[:,0] # first column of data frame (first_name)
data.iloc[:,1] # second column of data frame (last_name)
data.iloc[:,-1] # last column of data frame (id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment