Posts

Showing posts from November, 2020

62.Example Programs using numpy and pandas

Add two matrix and find the transpose of the result ( university question) def readmatrix(x,r,c):      for i in range(r):           for j in range(c):                x[i][j]=int(input('enter elements row by row')) import numpy as np r1=int(input('rows of a')) c1=int(input('columns of a')) r2=int(input('rows of b')) c2=int(input('columns of b')) if r1!=r2 or c1!=c2:      print("cant add matrices") else:      A=np.zeros((r1,c1))      print("Enter the elements of A")      readmatrix(A,r1,c1)      B=np.zeros((r2,c2))      print("Enter the elements of B")      readmatrix(B,r2,c2)      print("Matrix A")      print(A)      print("Matrix B")      print(B)      C=A+B      print("sum")      print(C)      print("transpose of sum")      print(C.T) Solving system of linear equations(university questions) let 2x1+3x2 +5x3= 10 3x1-2x2+x3=3 x1+5x2+7x3=8 import numpy as np A=np.array([[ 2 , 3,

61.Pandas-Panal Data and Python Data Analysis

Image
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 is an open-source library that is built on top of NumPy library. It is a Python package that offers various data structures and operations for manipulating numerical data and time series. It is mainly popular for importing and analyzing data much easier. Pandas is fast and it has high-performance and productivity for users. Pandas was initially developed by Wes McKinney in 2008 while he was working at AQR Capital Management. He convinced the AQR to allow him to open source the Pandas. Another AQR employee, Chang She, joined as the second major contributor to the library in 2012. T he source code for Pandas is located at this github repository https://github.com/pandas-dev/pandas Installation and