Showing posts with label PYTHON. Show all posts
Showing posts with label PYTHON. Show all posts

Saturday, December 15, 2018

R Vs Python: What’s the difference?

R and Python are both open-source programming languages with a large community. New libraries or tools are added continuously to their respective catalog. R is mainly used for statistical analysis while Python provides a more general approach to data science.
R and Python are state of the art in terms of programming language oriented towards data science. Learning both of them is, of course, the ideal solution. R and Python requires a time-investment, and such luxury is not available for everyone. Python is a general-purpose language with a readable syntax. R, however, is built by statisticians and encompasses their specific language.

R

Academics and statisticians have developed R over two decades. R has now one of the richest ecosystems to perform data analysis. There are around 12000 packages available in CRAN (open-source repository). It is possible to find a library for whatever the analysis you want to perform. The rich variety of library makes R the first choice for statistical analysis, especially for specialized analytical work.
The cutting-edge difference between R and the other statistical products is the output. R has fantastic tools to communicate the results. Rstudio comes with the library knitr. Xie Yihui wrote this package. He made reporting trivial and elegant. Communicating the findings with a presentation or a document is easy.

Python

Python can pretty much do the same tasks as R: data wrangling, engineering, feature selection web scrapping, app and so on. Python is a tool to deploy and implement machine learning at a large-scale. Python codes are easier to maintain and more robust than R. Years ago; Python didn't have many data analysis and machine learning libraries. Recently, Python is catching up and provides cutting-edge API for machine learning or Artificial Intelligence. Most of the data science job can be done with five Python libraries: Numpy, Pandas, Scipy, Scikit-learn and Seaborn.
Python, on the other hand, makes replicability and accessibility easier than R. In fact, if you need to use the results of your analysis in an application or website, Python is the best choice.

Difference between R and Python

ParameterRPython
ObjectiveData analysis and statisticsDeployment and production
Primary UsersScholar and R&DProgrammers and developers
FlexibilityEasy to use available libraryEasy to construct new models from scratch. I.e., matrix computation and optimization
Learning curveDifficult at the beginningLinear and smooth
Popularity of Programming Language. Percentage change4.23% in 201821.69% in 2018
Average Salary$99.000$100.000
IntegrationRun locallyWell-integrated with app
TaskEasy to get primary resultsGood to deploy algorithm
Database sizeHandle huge sizeHandle huge size
IDERstudioSpyder, Ipthon Notebook
Important Packages and librarytydiverse, ggplot2, caret, zoopandas, scipy, scikit-learn, TensorFlow, caret
DisadvantagesSlow High Learning curve Dependencies between libraryNot as many libraries as R
Advantages
  • Graphs are made to talk. R makes it beautiful
  • Large catalog for data analysis
  • GitHub interface
  • RMarkdown
  • Shiny
  • Jupyter notebook: Notebooks help to share data with colleagues
  • Mathematical computation
  • Deployment
  • Code Readability
  • Speed
  • Function in Python

Saturday, May 19, 2018

PYTHON

What is Python?

Python is a popular programming language. It was created in 1991 by Guido van Rossum.
It is used for:
  • web development (server-side),
  • software development,
  • mathematics,
  • system scripting.
Python is a general purpose, dynamic, high level and interpreted programming language. It supports Object Oriented programming approach to develop applications. It is simple and easy to learn and provides lots of high-level data structures.
Python is easy to learn yet powerful and versatile scripting language which makes it attractive for Application Development.
Python's syntax and dynamic typing with its interpreted nature, makes it an ideal language for scripting and rapid application development.
Python supports multiple programming pattern, including object oriented, imperative and functional or procedural programming styles.
Python is not intended to work on special area such as web programming. That is why it is known as multipurpose because it can be used with web, enterprise, 3D CAD etc.
We don't need to use data types to declare variable because it is dynamically typed so we can write a=10 to assign an integer value in an integer variable.
Python makes the development and debugging fast because there is no compilation step included in python development and edit-test-debug cycle is very fast.


What can Python do?

  • Python can be used on a server to create web applications.
  • Python can be used alongside software to create workflows.
  • Python can connect to database systems. It can also read and modify files.
  • Python can be used to handle big data and perform complex mathematics.
  • Python can be used for rapid prototyping, or for production-ready software development.

Why Python?

  • Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
  • Python has a simple syntax similar to the English language.
  • Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
  • Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
  • Python can be treated in a procedural way, an object-orientated way or a functional way.

Python History

  • Python laid its foundation in the late 1980s.
  • The implementation of Python was started in the December 1989 by Guido Van Rossum at CWI in Netherland.
  • In February 1991, van Rossum published the code (labeled version 0.9.0) to alt.sources.
  • In 1994, Python 1.0 was released with new features like: lambda, map, filter, and reduce.
  • Python 2.0 added new features like: list comprehensions, garbage collection system.
  • On December 3, 2008, Python 3.0 (also called "Py3K") was released. It was designed to rectify fundamental flaw of the language.
  • ABC programming language is said to be the predecessor of Python language which was capable of Exception Handling and interfacing with Amoeba Operating System.
  • Python is influenced by following programming languages:
    • ABC language.
    • Modula-3

Python Syntax compared to other programming languages

  • Python was designed to for readability, and has some similarities to the English language with influence from mathematics.
  • Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.
  • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.

Tuesday, February 13, 2018

python

Python Moudule

Modules are used to categorize code in Python into smaller part. A module is simply a file, where classes, functions and variables are defined. Grouping similar code into a single file makes it easy to access.
Have a look over example:
If the content of a book is not indexed or categorized into individual chapters, then the book might have turned boring and hectic. Hence, dividing book into chapters made it easy to understand.
In the same sense python modules are the files which have similar code. Thus module is simplify a python code where classes, variables and functions are defined.
Advantage:
Python provides the following advantages for using module:
1) Reusability: Module can be used in some other python code. Hence it provides the facility of code reusability.
2) Categorization: Similar type of attributes can be placed in one module.

Importing a Module:

There are different ways by which you we can import a module. These are as follows:

1) Using import statement:

"import" statement can be used to import a module.
Syntax:
  1. import <file_name1, file_name2,...file_name(n)="">  
  2. </file_name1,>  
Have a look over an example:
eg:
  1. def add(a,b):  
  2.     c=a+b  
  3.     print c  
  4.     return  
Save the file by the name addition.py. To import this file "import" statement is used.
  1. import addition  
  2. addition.add(10,20)  
  3. addition.add(30,40)

Sunday, August 20, 2017

python part 2

Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> print("hello")
hello
>>> print("hii prakash")
hii prakash
>>> a=10
>>> print(a)
10
>>> name ="prakash"
>>> print(name)
prakash
>>> b=12.23
>>> print(b)
12.23
>>> a=12
>>> b=23
>>> c=a+b
>>> print(c)
35
>>> c=a-b
>>> print(c)
-11
>>> c=a*b
>>> print(c)
276
>>> c=a/b
>>> print(c)
0.5217391304347826
>>> c=a%b
>>> print(c)
12
>>> prakash=dev=puneet=abhi=akash=virat=tanya=rashi=animesh="BBD"
>>> print(abhi)
BBD
>>> print(animesh)
BBD
>>> print(virat)
BBD
>>> student,fee,father="prakash",12,"father"
>>> print(fee)
12
>>> print(father)
father
>>> 

PYTHON

                            PYTHON
1.open Source language
2.it was developed by Guido van Rossum.

featares of python
1. easy to learn
2. Simple synax
3. Huge nume of laibraries

Python is an object-oriented,
 high level language, interpreted,
 dynamic and multipurpose programming language.

 Python is derived from many other languages,
 including ABC, Modula-3,
 C, C++, Algol-68, SmallTalk, and
 Unix shell and other scripting languages.

Python is copyrighted. Like Perl,
 Python source code is now available
 under the GNU General Public License (GPL).

Video link   VIDEO