{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", " | Unnamed: 0 | \n", "Private | \n", "Apps | \n", "Accept | \n", "Enroll | \n", "Top10perc | \n", "Top25perc | \n", "F.Undergrad | \n", "P.Undergrad | \n", "Outstate | \n", "Room.Board | \n", "Books | \n", "Personal | \n", "PhD | \n", "Terminal | \n", "S.F.Ratio | \n", "perc.alumni | \n", "Expend | \n", "Grad.Rate | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "Abilene Christian University | \n", "Yes | \n", "1660 | \n", "1232 | \n", "721 | \n", "23 | \n", "52 | \n", "2885 | \n", "537 | \n", "7440 | \n", "3300 | \n", "450 | \n", "2200 | \n", "70 | \n", "78 | \n", "18.1 | \n", "12 | \n", "7041 | \n", "60 | \n", "
Ok lets just select first 5 rows from our dataframe. checkout tutorial Select Pandas Dataframe Rows And Columns Using iloc loc and ix" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "df5r = dfn.loc[:4,:]" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(5, 3)" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df5r.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Remember pd.DataFrame.size will give you the size of the dataframe rowsxcolumns" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So We got first 5 rows and 3 columns." ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "15" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df5r.size" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Private | \n", "Apps | \n", "Accept | \n", "
---|---|---|---|
0 | \n", "Yes | \n", "1660 | \n", "1232 | \n", "
1 | \n", "Yes | \n", "2186 | \n", "1924 | \n", "
2 | \n", "Yes | \n", "1428 | \n", "1097 | \n", "
3 | \n", "Yes | \n", "417 | \n", "349 | \n", "
4 | \n", "Yes | \n", "193 | \n", "146 | \n", "