5 Business Ideas to Make Money From Your Laptop

Are you fed up with the 9–5 grind; sitting in traffic twice a day and working for a boss you can’t stand? Do you want to escape the rat-race but have no idea where to start? Then you’re in the right…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Python for Data Science

Introduction to Python for data science and analytics. This post is about python basics that helped me start my journey in Data Science.

Post covers:

Python has gained a lot of interest, especially in the analytics world. Python is very easy to learn and easy to use language. Apart from being open-source: free to install Python saves a lot of programmers time by providing simple programming syntax code readability.

With attention over the period, Python has now a rich set of standard libraries and frameworks for several purposes. For example, Django and Flask for developing web applications, TensorFlow for deep learning, and pandas for data analysis, etc.

Without further ado, let's jump straight to Python concepts:

Python has many data types. The most common ones are integer, float, boolean, string, list, tuples, and dictionary.

Integers(Int): used for integer values.

Floating point (Float): used for decimal point numbers.

Strings (str): Strings are defined by using single, double, and triple inverted commas. Strings are immutable so you can not be change part of a string.

Lists (list): A list is a series of comma-separated values enclosed in square brackets. Each value in the list is separated by a comma. Lists are mutable and individual elements of a list can be edited.

Tuples (tup): tuples are a number of values separated by a comma. Tuples are immutable and are preferred over a list for their fast processing. If your list is unlikely to change you can use tuples.

Dictionary (dict): Dictionary is an unordered set of key-value. Every dictionary has a unique set of keys. Dictionary is created using braces.

Some Methods for slicing and indexing list.

List duplication, By assigning directly to new list actually points to the same list, and further editing results in changes in the list pointing to 2 variables.

The method used to make a copy of the list is .copy(). This will result in a separate list and further changes made will not affect the original list.

In python for loop is the most widely used for iteration.

syntax:

Conditional statements are used to execute code based on conditions. The most commonly used conditional statements are if-else.

syntax:

A function is a reusable piece of code for solving a specific task. Functions are designed using the def keyword. There are many built-in functions in python like print(). The functions built by the user are called user-defined functions.

syntax:

A module is a file containing a single python file and Package is a directory of modules. Modules specify functions, methods, and python scripts that solve a particular set of problems.

Packages like NumPy, pandas, matplotlib, seaborn are some of the well known and used packages in data science.

Some packages are pre-installed to use however many more packages are there that if we want to use we can install them using pip install.

Once we have installed the package, we can import the entire package, subsections, or just a function from the package. Also, you can use alias fro making easy future use of the package or function rather than mentioning the whole package/ function name again and again.

We can also do something like this from pandas import *. The asterisk symbol here means to import everything from that module. This import statement creates references in the current namespace to all public objects defined by the pandas module. In other words, we can just use all available functions from pandas only with their names without prefix. For example, now we can use the pandas function without mentioning the package name.

Not recommended as

Might not be readable from where the function is coming as in which package has a particular function.

Also, if two packages happen to have the same function name the latest one will override the first one.

Pandas for structured data operations and manipulations. It is extensively used for data munging and preparation. Pandas were added relatively recently to Python and have been instrumental in boosting Python’s usage in the data scientist community.

Describe function describes data statistically.

Some other operations.

NumPy stands for Numerical Python. The most powerful feature of NumPy is the n-dimensional array. This library also contains basic linear algebra functions, Fourier transforms, advanced random number capabilities, and tools for integration with other low-level languages like Fortran, C, and C++

In this article, I tried covering the very basics of python in the world of data science. I’ll be posting another article about the pandas' package and Introduction to Data Science. Also, I plan on covering all the plotting tricks in upcoming article.

Happy learning!

Add a comment

Related posts:

The New Medium App Sucks

What a mistake. It is like Medium hates its writers. This is becoming more and more frustrating to me. We can no longer write or edit from the app with the latest update. This isn’t a massive deal…

Easiest Way To Learn Python Code.

The same question repeats always that what python is. Some people say that it is a very tough language to learn but here python24x7 will help you all to learn python language in a proper manner and…

My Favorite Villains

Villains are an integral part of comic books. Arguably more important than their heroic counterparts at times, some consider them the real MVPs of a lot of beloved stories. Would we really be able to…