# Data Science Project on President Heights

Data Science project for Beginners on US-President Height using python.

If you are a beginner in Data Science you must solve this project, as you will learn a lot about working on Data, that comes from a csv file or any other formats.

This data is available in the file heights.csv, which is a simple comma-separated list of labels and values:

```data = pd.read_csv("heights.csv")

We’ll use the Pandas package to read the file and extract this information (note that the heights are measured in centimeters):

```height = np.array(data["height(cm)"])
print(height)```

Now that we have this data array, we can compute a variety of summary statistics:

```print("Mean of heights =", height.mean())
print("Standard Deviation of height =", height.std())
print("Minimum height =", height.min())
print("Maximum height =", height.max())```

Note that in each case, the aggregation operation reduced the entire array to a single summarizing value, which gives us information about the distribution of values. We may also wish to compute quantiles:

```print("25th percentile =", np.percentile(height, 25))
print("Median =", np.median(height))
print("75th percentile =", np.percentile(height, 75))```

We see that the median height of US presidents is 182 cm, or just shy of six feet. Of course, sometimes it’s more useful to see a visual representation of this data, which we can accomplish using tools in Matplotlib:

```import matplotlib.pyplot as plt
import seaborn as sns
sns.set()```
```plt.hist(height)
plt.title("Height Distribution of Presidents of USA")
plt.xlabel("height(cm)")
plt.ylabel("Number")
plt.show()```

These aggregates are some of the fundamental pieces of exploratory data science that we’ll explore in more depth in later coming projects. ##### Aman Kharwal

Coder with the ♥️ of a Writer || Data Scientist | Solopreneur | Founder

Articles: 1238

1. #### Work on Data Science Projects | Data Science | Machine Learning | Python

[…] Data Science Project on President Heights […]

2. #### Joe Datrin

what is the use of sns.set() sir?

• #### Aman Kharwal

sns.set() (which means seaborn.set()), is used over matplotlib. For using the styles provided by seaborn for visualization you don’t need to prepare your data to fit in any method of seaborn. You just need to call the seaborn.set() method and it will automatically change the style of your matplotlib’s plot to seaborn’s plot.

3. #### Tark

For beginners, just add the necessary import for panda and numpy for clarity

• #### Aman Kharwal

sure, thanks for your valuable feedback, keep visiting us.

4. #### hoshang14

From where we can get the data set? I didnot find any link to download the data?

• #### Aman Kharwal

A link for the dataset heights.csv is available of the second paragraph. You can download the dataset from here.

5. #### Lalit Thakur

data.describe() can be used as well

yes

thank you……!

• #### Aman Kharwal

Most welcome

7. #### Dan

Excellent project for beginner .. thanks!

• #### Aman Kharwal

Thanks, keep visiting