Dataframe is a two dimensional data structure, where data is stored in a tabular format, in the form of rows and columns.It can be visualized as an SQL data table or an excel sheet representation. It can be created using the following constructor −pd.Dataframe(data, index, columns, dtype, copy)A new column can be added to a dataframe in different ways.Let us see one of the ways, in which a new column is created by first forming a series data structure and passing this as an additional column to the existing dataframe.Let us see the code in action −Example Live Demoimport pandas as ... Read More
Dataframe is a two dimensional data structure, where data is stored in a tabular format, in the form of rows and columns.It can be visualized as an SQL data table or an excel sheet representation.It can be created using the following constructor −pd.Dataframe(data, index, columns, dtype, copy)The ‘data’, ‘index’, ‘columns’, ‘dtype’ and ‘copy’ are not compulsory values.A list of dictionaries can be passed as input to the dataframe. The keys of dictionary are taken as column names by default. Let us see an example −Example Live Demoimport pandas as pd my_data = [{'ab' : 34}, {'mn' : 56}, { 'gh' : ... Read More
When the index values are customized, they are accessed using series_name[‘index_value’]. The ‘index_value’ passed to series is tried to be matched to the original series. If it is found, that corresponding data is also displayed on the console.When the index that is tried to be accessed is not present in the series, it throws an error. It has been shown below.Example Live Demoimport pandas as pd my_data = [34, 56, 78, 90, 123, 45] my_index = ['ab', 'mn' ,'gh', 'kl', 'wq', 'az'] my_series = pd.Series(my_data, index = my_index) print("The series contains following elements") print(my_series) print("Accessing elements using customized index") print(my_series['mm'])OutputThe series ... Read More
When the index values are customized, they are accessed using series_name[‘index_value’].The ‘index_value’ passed to series is tried to be matched to the original series. If it is found, that corresponding data is also displayed on the console.Let us see how multiple elements can be displayed.Example Live Demoimport pandas as pd my_data = [34, 56, 78, 90, 123, 45] my_index = ['ab', 'mn' ,'gh', 'kl', 'wq', 'az'] my_series = pd.Series(my_data, index = my_index) print("The series contains following elements") print(my_series) print("Accessing multiple elements using customized index") print(my_series[['mn', 'az', 'wq', 'ab']])OutputThe series contains following elements ab 34 mn 56 gh 78 kl 90 wq ... Read More
Scalar or constant values are defined once, and they are repeated across all rows/entries of the series data structure. Following is an example −Example Live Demoimport pandas as pd my_index = ['ab', 'mn' ,'gh', 'kl'] my_series = pd.Series(7, index = my_index) print("This is series data structure created using scalar values and specifying index values") print(my_series)OutputThis is series data structure created using scalar values and specifying index values ab 7 mn 7 gh 7 kl 7 dtype: int64ExplanationThe required libraries are imported, and their alias are given so that it is easy to use them.A list of index ... Read More
Visualizing data is an important step since it helps understand what is going on in the data without actually looking at the numbers and performing complicated computations. Seaborn is a library that helps in visualizing data.Scatter plot shows the distribution of data as data points that are spread/scattered on the graph. It uses dots to represents values of a dataset, which are numeric in nature. The position of every dot on the horizontal and vertical axis denotes the value for a single data point.They help understand the relationship between two variables. Let us understand how this can be achieved using ... Read More
Let us see how a series data structure can be created with the help of a Numpy array, and explicitly giving values for ‘index’.When no value is specified for index, default values beginning from 0 are assigned to values in the series.Following is an example −Example Live Demoimport pandas as pd import numpy as np my_data = np.array(['ab', 'bc', 'cd', 'de', 'ef', 'fg', 'gh', 'hi']) my_index = [3, 5, 7, 9, 11, 23, 45, 67] my_series = pd.Series(my_data, index = my_index) print("This is series data structure created using Numpy array and specifying index values") print(my_series)OutputThis is series data structure created using ... Read More
A neuron is a mathematical function that takes one or more values as input and outputs a ingle numerical value −It can be defined as follows −Here, ‘f’ refers to the function.We first computed the weighted sum of the inputs xi and the weights wiThe weight wi is also known as the activation value or activation function.The input xi can be a numerical value that represents the input data or it can be an output from other neurons if the neuron belong to a neural network.The weight wi is a numerical value that can be used to represent the strength ... Read More
A neural network can be understood as a network of hidden layers, an input layer and an output layer that tries to mimic the working of a human brain.The hidden layers can be visualized as an abstract representation of the input data itself. These layers help the neural network understand various features of the data with the help of its own internal logic.These neural networks are non-interpretable models. Non-interpretable models are those which can’t be interpreted or understood even if we observe the hidden layers. This is because the neural networks have an internal logic working on its own, that ... Read More
The basic example of a neural network is a ‘perceptron’. It was invented by Frank Rosenblatt in 1957. The perceptron is a classification algorithm similar to logistic regression. This because, similar to logistic regression, a perceptron has weights, w, and an output function, ‘f’, which is a dot product of the weights and the input.The only difference is that ‘f’ is a simple step function, where a logistic regression rule is applied to the output of the logistic function. On the other hand, perceptron can be understood as an example of a simple one-layer neural feedforward network.The perceptron was considered ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP