Posts

Showing posts from October, 2024

Data Analysis Library : NumPy

Image
Data Analysis Library : NumPy NumPy is a 3rd party library which is considered as defacto standard for handling multidimensional array in Python, it serves as the base library for many of the data analytics, machine learning & deep learning libraries which are out there. But to explain multidimensional array we need to see few examples. For display purposes we have created a function which has few defined functions  ndim(): displays the number of dimensions of the array. size: displays the size of the array. shape: displays the shape of the array and displays no of elements in each dimension of the array dtype: Shows the datatype of the array which generally is a NumPy datatype. import numpy as np def display ( array:np.ndarray ): result= f""" The array is {array} 1. The no. of dimesions : {array.ndim} 2. The size of array : {array.size} 3. The shape of array : {array.shape} 4. The...

Pandas Data Frame Operations

Image
  Pandas Data Frame In Pandas library , Data Frame is a 2 dimensional array with rows and columns where each row and column are pandas Series. Data frame has row and column index which can be used to access the data. Lets explain this with an example. First we will import pandas library. Lets create some random data for our Data Frame operations, We created this data frame from data created as a dictionary. And we saw how our data looks like in the frame, now we will see few common operations we can perform on the dataframe. 1. Head Operations: Shows us the first 5 rows by default and we can specify any number of rows we can see. 2. Tail Operations: Shows us the last 5 rows by default and we can specify any number of rows we can see. 3. Accessing Columns from the Data Frame : There are several ways we can access a particular column or a group of columns, they can be indexing, or using the loc or iloc function, we will discuss about them as we go on through the article. Through all ...

Pandas Series Operations

Image
Pandas Series The Pandas library contains specialized data structures known as Data frames which are like an excel worksheet while representing data in form of rows and columns. The data frames in pandas are collection of pandas series which are 1 dimensional array of a constant datatype used to represent any sequence of objects in pandas. Collection of pandas series row wise and column wise creates a pandas data frame. Let’s start with the basic pandas series. We will be utilizing Jupiter notebooks in Visual Studio Code for our tasks, but you can do this in any python code editor which has pandas installed on it. We will start by importing pandas as After we have successfully imported pandas. We will start by creating a pandas Series. As you can see from the above the representation of the series is given in the form of key value pair. Here the key is index which is given in the left from 0 to 3 and the values are on the right. We can separately see the index or change it as per our n...