Intro to Python for Data Science

Hello World! Today’s post is going to be computer science related. Recently I’ve started Data Science with Python track at DataCamp. DataCamp offers interactive courses with amazing instructors. All on topics in data science, statistics and machine learning. 

In this post I will share my notes from the first course of Data Science with Python track. I am hoping that this post will share with you some basics of python for data science.

“Data Science”

You probably heard this term before, if not, don’t worry, now you do. 🙂

A nice definition of Data Science by University of Berkeley; Data science continues to evolve as one of the most promising and in-demand career paths for skilled professionals. Today, successful data professionals understand that they must advance past the traditional skills of analyzing large amounts of data, data mining, and programming skills.

If you are a visual learner like myself here is a 5 minute video by Simplilearn. The video contains a bit detailed information but it gives sense of the big picture.

I would like to write another post, what data science really is and why it is so important. But in this post it will more like me sharing my lecture notes from the first course.

Let’s get started!

What is List?

  • Powerful
  • Collection of values
  • Holds different types
  • Change, add, or remove elements

 

Changing list elements

Screen Shot 2019-03-21 at 8.19.46 PM.png

Adding and removing elements

Screen Shot 2019-03-21 at 8.20.30 PM.png

Functions

  • Piece of reusable code
  • Solves particular task
  • Call function instead of writing the whole code yourself

Here are some built-in functions

  • max(): Maximum of the list
  • min(): Minimum of the list
  • len(): length of the list or string
  • index(): get index of the element in list. (this a method)
  • reverse(): reverse a list. (this is a method)

List methods

Screen Shot 2019-03-21 at 8.21.38 PM.png

String methods

Screen Shot 2019-03-21 at 8.22.32 PM.png

Methods

  • Everything = object
  • Objects have methods associated, depending on type

Packages

  • Directory of python scripts
  • Each script is a module
  • Specify functions, methods, and types
  • Thousands of packages are available such as:
    • NumPy
    • Pandas
    • Matplotlib
    • Scikit-learn

How to use a package:

  1. Install package
  2. Import package
  3. Now you can use the package

Screen Shot 2019-03-21 at 8.23.47 PM.png

Example use of NumPy:

Screen Shot 2019-03-21 at 8.24.21 PM.png

Screen Shot 2019-03-21 at 8.31.19 PM.png

Screen Shot 2019-03-21 at 8.31.27 PM.png

Screen Shot 2019-03-21 at 8.32.24 PM.png

Screen Shot 2019-03-21 at 8.32.35 PM.png

We can also play on two dimensional arrays with NumPy:

Screen Shot 2019-03-21 at 8.33.15 PMScreen Shot 2019-03-21 at 8.33.23 PMScreen Shot 2019-03-21 at 8.33.33 PM

Indexing in multi-dimensional NumPy arrays

Screen Shot 2019-03-21 at 8.34.46 PM.png

We can also do statistical calculations using NumPy package (Such as: mean, median, correlation coefficient, standard deviation, sort, sum)

Screen Shot 2019-03-21 at 8.34.56 PM.png

 

That’s all for now!

What are your thoughts on data science?

Did you know that Harvard University mentioned Data Science as “the sexiest job” of 21st century.

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: