# Inspecting DataFrames

Pandas provides some simple methods to look at your dataframes:&#x20;

* `[your_dataframe_name].head(5)` will provide the first 5 rows
* `[your_dataframe_name].tail(10)` will provide the last 10 rows
* `[your_dataframe_name].describe()` is a quick way to get summary statistics on a per-column basis

You can find more useful pandas functions \[[here](https://pandas.pydata.org/pandas-docs/stable/reference/frame.html)]

```
ms.head() #this will give the first 5 rows by default. You can add any number in the () to get that number of rows
```

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2F3j8mZNHMsvMDRSflhzt6%2Fimage.png?alt=media&#x26;token=825f1c4f-330b-4c08-93ef-ab60c9773faa" alt=""><figcaption></figcaption></figure>

```
ms.tail(10) #and the last 10 rows
```

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FsyR0rke28l4lOMnayvMX%2Fimage.png?alt=media&#x26;token=9c7fc141-7c40-4b11-b919-b6ba79fd9035" alt=""><figcaption></figcaption></figure>

```
ms.describe() #this is a quick way to get summary statistics on a per-column basis
```

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FI8rUpxsdnHBZFAes8C5s%2Fimage.png?alt=media&#x26;token=03cf834e-241d-497d-916d-304e25a36e26" alt=""><figcaption></figcaption></figure>

```
#What do you notice about the number of columns returned by describe vs that in the entire dataframe...
ms.shape
```

(216, 183)

```
ms.columns
```

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FSiquK3jCn4gl6Dz6IQ1g%2Fimage.png?alt=media&#x26;token=d7e59312-4556-499c-84eb-ef70ae04ce05" alt=""><figcaption></figcaption></figure>

```
missing = []
des_cols = ms.describe().columns
for col in ms.columns:
    if col in des_cols:
        print('found: '+ col)
    else:
        missing.append(col)
```

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FAz0QcxOf0B6jSg4hF9ri%2Fimage.png?alt=media&#x26;token=91ee1c30-c700-4158-8234-fc7efb319308" alt=""><figcaption></figcaption></figure>

```
missing
```

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2Fmw98EHLM58t7GYFuz82W%2Fimage.png?alt=media&#x26;token=030aef99-0a5a-4c91-b153-6bc70e23086a" alt=""><figcaption></figcaption></figure>

```
pd.set_option('display.max_rows', 50) #This will set the number of rows you can "see" in the jupyter notebook when you inspect a dataframe
pd.set_option('display.max_columns', 200) #This will set the number of columns you can "see" in the jupyter notebook when you inspect a dataframe
```

```
ms.describe() #notice the difference in the number of columns you can see
```

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FjCz9kBhkP5NbumtLCUGo%2Fimage.png?alt=media&#x26;token=aa5e0706-493b-4621-8d8b-068979513778" alt=""><figcaption></figcaption></figure>
