Python Tutorials – 1.6 – Class and Instances

On October 19, 2017, in Python, by Aritra Sen

Tagged with:
 

Python Tutorials – 1.5 – Numpy

On October 11, 2017, in Python, by Aritra Sen

Numpy is the short form of ‘Numerical Python‘. This is one library you should learn if you are interested in Data Science with Python. The core of Numpy is it’s N-Dimension Array which is similar to List but has many advance over List like –

  • More compact.
  • Faster access in Reading and writing items.
  • Ease of doing element wise operation in Numpy.
  • Numpy has inbuilt functions to do mathematical operations on arrays.

As we are using Jupyter notebook from Anaconda , Numpy library is already installed in Anaconda. But we need to import the Numpy library. Now lets look into the Numpy array , it’s advantages over list and different available functionalities of Numpy.

 

Tagged with:
 

In this tutorial we will look into the code – to do sorting on different Python objects.

Also we will look into use of Zip function and how this function can be applied to the dictionary to get the min , max and sort by key/values.

 

Tagged with:
 

In Python we have many built-in functions like print() , len() but we can define our own reusable functions which can perform user defined set of operations.

How to define a function:

  • function definition starts with def keyword and followed by function name & ()
  • Within the () we write the input parameters.
  • Followed by : and indentation , we should avoid wrong indentation to avoid code error.
  • end with an optional return statement to return the values from where the function was called , this also exists the function.

Below is an example in the form of code.

Lambda Expression/Functions (Anonymous Functions): 

  • This type functions does not have any names and does not start with def keyword.
  • Lambda functions takes any number of arguments and returns only one value in the form of expression.
  • This function will have only one line.
  • Syntax – lambda arguments: expression
  • Lambda functions are used in combination with in built map & filter functions.
  • Also used in sorting operations.

Now lets look at examples in code & see how to use Lambda expression/functions –

In Maps and filters , we can use other in built or user defined functions.

Tagged with:
 

Python Tutorials – 1.2 – DataTypes Conversion and Loops

On September 23, 2017, in Python, by Aritra Sen

When you are playing with data , you will come across with the situations when you need to do datatype conversion , there are several built in functions which can help us perform this activity. Below , I have given few examples –

Whenever you want to run a block of code again and again you need to run loops , below are different types of loop available in Python –

 

Tagged with:
 

Python Tutorials – 1.1 – Variables and Data Types

On September 19, 2017, in Python, by Aritra Sen

Before starting with Python Variables, let’s look into the different mathematical operations you can do in Python.

Python is not strictly typed language , so you don’t need declare the type of the variable and then use.You can straightway assign the values of variables and python will understand the type of the variables. Below are types of variables –

  • Numbers
  • String
  • List
  • Tuple
  • Dictionary

Tagged with:
 

Python Tutorials – 1.0 – Getting Started

On September 18, 2017, in Uncategorized, by Aritra Sen

From the mid of this year , I found my new interest and i.e. Data Science , I should say Data Science with Python. Though I am just a beginner in this field but the more you share your knowledge , the more it benefits you.

This would be a series of tutorials where I will share and increase my knowledge for Python. May be if it goes well , I will be share my small knowledge of Data Science which I gathered so far.

Why Python?

Python was developed by Guido Van Rossum. Python is a general purpose – open source, easy to learn language which now being used in various field like –

  • Data Science
  • Deep Learning
  • Web development
  • Web scrapping
  • Game development  and this list is never ending.

Along with Python has a number of standard libraries which makes life of a programmer much easier since you don’t have to write all the code yourself. For example to call a web-service in Python you need to write hardly 4/5 lines of code.

Or by using scikit learn library you can create robust data science model very easily.

Python Interpreted Language:

C, C++ is complied language but Python is a Interpreted language. In complied language compiler first compiles the whole program then run the program , however in Python the interpreter will parse the language line by line.

Next article would be Python data types and variables.

Note : In this tutorial series , we will use Python 3 and Jupyter notebook which comes with Anaconda-  4.4.0.

 

Tagged with: