Anaconda, Pandas, and NumPy PDF
Document Details
Tags
Summary
This document provides an introduction to Anaconda, Pandas, and NumPy, which are Python libraries used for scientific computing, data analysis, and working with arrays. It includes examples and explanations.
Full Transcript
Anaconda Anaconda is a distribution of the Python and R programming languages for scientific computing, that aims to simplify package management and deployment. The distribution includes data-science packages suitable for Windows, Linux, and macOS. Pandas pandas is a fast, powerful, f...
Anaconda Anaconda is a distribution of the Python and R programming languages for scientific computing, that aims to simplify package management and deployment. The distribution includes data-science packages suitable for Windows, Linux, and macOS. Pandas pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool,built on top of the Python programming language. Pandas is a Python library used for working with data sets. It has functions for analyzing, cleaning, exploring, and manipulating data. The name "Pandas" has a reference to both "Panel Data", and "Python Data Analysis" and was created by Wes McKinney in 2008. Pandas allow us to analyze big data and make conclusions based on statistical theories Pandas can clean messy data sets and make them readable and relevent Eg:1 from pandas import Series se=Series([1,2,3,4,6]) Se Eg:2 import pandas as pd a=[1,2,3,4] myvar=pd.Series(a) myvar Eg:3 se2=Series([100,200,300],index=['a','b','c']) Se2 Eg:4 se2=Series([100,200,300],index=['a','b','c']) se2['c’] Eg:5 salary={'john':1000,'tim':2000,'rahul':3000} se=Series(salary) se Eg: 6 salary={'john':1000,'tim':2000,'rahul':3000} se=Series(salary) se salary se['tim'] NumPy NumPy is a python library used for working with arrays It also has functions for working in domain of linear algebra, fourier transform, and matrices. NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays. NumPy stands for Numerical Python. In python we have lists that serves the purpose of arrays,but they are slow to process NumPy provide an object that is upto 50 times faster than lists The array object in NumPy is called ndarray Eg:1 import numpy x=numpy.array([15,80,10,25]) X Eg: 2 import numpy x=numpy.array([15,80,10,25]) print(x) Eg:3 import numpy as np y=np.array([40,10,20,50]) print(y) Eg:4 import numpy as np z=np.array((40,20,10,60)) print(z) Eg:5 import numpy as np x1=np.array([[10,50,20],[60,70,30]]) print(x1) Eg:6 import numpy as np y1=np.array([[1,2,3],[11,22,33],[111,222,333]]) print(y1) Eg:7 import numpy as np y1=np.array([[1,2,3],[11,22,33],[111,222,333]]) print(y1.ndim) Eg:8 import numpy as np w=np.array([[[1,2,3],[4,5,6]],[[7,8,9],[1,4,5]]]) print(w) Eg:9 import numpy as np w=np.array([[[1,2,3],[4,5,6]],[[7,8,9],[1,4,5]]]) print(w[1,1,0]) Eg:10 import numpy as np w=np.array([[[1,2,3],[4,5,6]],[[7,8,9],[1,4,5]]]) print(w[0,1,2]) Eg:11 import numpy as np w=np.array([[[1,2,3],[4,5,6]],[[7,8,9],[1,4,5]]]) print(w.ndim)