Found 10784 Articles for Python

Drop Empty Columns in Pandas

Devesh Chauhan
Updated on 05-May-2023 13:08:22

8K+ Views

Pandas data frame is a very powerful data manipulation tool. It is a tabular data structure consisting of rows and columns. The size of this 2-D matrix can be variable depending upon the complexity of the dataset. We can use different type of sources to create a data frame ranging from databases to files. The columns in a pandas data frame represents a series of information and it can be an integer, float, or string. We can perform numerous operations on these columns including deletion, indexing, filtering etc. In this article, we will perform one such basic operation of ... Read More

Drop duplicate rows in PySpark DataFrame

Devesh Chauhan
Updated on 05-May-2023 13:04:34

366 Views

PySpark is a tool designed by the Apache spark community to process data in real time and analyse the results in a local python environment. Spark data frames are different from other data frames as it distributes the information and follows a schema. Spark can handle stream processing as well as batch processing and this is the reason for their popularity. A PySpark data frame requires a session in order to generate an entry point and it performs on-system processing of the data (RAM). You can install PySpark module on windows using the following command – pip install pyspark ... Read More

Drop columns in DataFrame by label Names or by Index Positions

Devesh Chauhan
Updated on 05-May-2023 13:01:50

129 Views

A pandas data frame is a 2D data structure consisting of a series of entities. It is very useful in the analysis of mathematical data. The data is arranged in a tabular manner with each row behaving as an instance of the data. A Pandas data frame is special because it is empowered with numerous functions making it a very powerful programming asset. Each column in a data frame represents a series of information which is labelled. In this article, we will operate on these columns and discuss the various methods to drop columns in a pandas data frame. ... Read More

Drop Collection if already exists in MongoDB using Python

Devesh Chauhan
Updated on 05-May-2023 12:58:01

423 Views

MongoDB is a widely popular open-source database that stores data in a flexible JSON like format. It does not use the orthodox technique of storing data in rows and columns. Instead, it uses a more flexible approach which increases its scalability. This database is designed to handle large volumes of data and therefore, it is tailor made for modern applications. A MongoDB database consists of “collections” which is similar to a table in a RDBMS. A collection is a group of documents consisting of fields with different types of values. A database can contain numerous collections and each ... Read More

Drop a list of rows from a Pandas DataFrame

Devesh Chauhan
Updated on 05-May-2023 12:55:13

317 Views

The pandas library in python is widely popular for representing data in the form of tabular data structures. The dataset is arranged into a 2-D matrix consisting of rows and columns. Pandas library offers numerous functions that can help the programmer to analyze the dataset by providing valuable mathematical insights. The tabular data structure is known as a data frame that can be generated with the help of pandas DataFrame() function. In this article we will perform a simple operation of removing/dropping multiple rows from a pandas data frame. Firstly, we have to prepare a dataset and then ... Read More

How to Locate Elements using Selenium Python?

Saba Hilal
Updated on 04-May-2023 17:49:34

815 Views

With the frequent change in technology to present the content on the web it is often needed to redesign and restructure the content of the web pages or websites. Selenium with Python is a good combination that is helpful to extract the desired content from web pages. Selenium is a free open-source automated tool that is used for evaluating web applications across multiple platforms. Selenium Test Scripts can be written in a variety of computer languages such as Java, C#, Python, NodeJS, PHP, Perl, etc. In this Python Selenium article, using two different examples, the ways to locate elements of ... Read More

How to iterate through a nested List in Python?

Saba Hilal
Updated on 04-May-2023 17:45:23

4K+ Views

In this article, we will understand the concept of nested Lsit in Python and how to iterate through a nested list in Python language, Sometimes, the task is to go through each element of a list or to find the elements in a list or to use the information given in a list. In all these cases, one has to iterate through a list. The list can be made up of a single type of elements or multiple types of elements can be used in a list. The three different examples would be used to represent the different ways ... Read More

How to invert the elements of a boolean array in Python?

Saba Hilal
Updated on 04-May-2023 17:39:39

625 Views

Sometimes, the task is to invert a boolean array. This is often required if the files contain a column with true or false values and the need is to use the column values in the inverted manner. For example, if a CSV file contains the data column as Covid Negative status showing True for covid –ve patients and the need is to create a column of covid+ve status. In such cases, the array inversion for the boolean values is required. In this Python article, using four different examples, the different ways to invert a Boolean array with or without using ... Read More

How to make a basic Scatterplot using Python-Plotly?

Saba Hilal
Updated on 04-May-2023 17:23:50

561 Views

Sometimes, the task is to analyze a dataset and use charts or plots for data visualization. Plotly is a nice open-source graphing library that can be used with Python and is used for making a variety of plots and charts quickly and easily. In this article, using two different examples, this Python library called Plotly is used with Python code to make the scatter plots. In the first example, the Python installed in the computer system is used to run a Python program that is written for making a scatter plot. In another example, using the Google Colab the ... Read More

How to Make a Bell Curve in Python?

Saba Hilal
Updated on 14-Jul-2023 17:17:33

1K+ Views

It is a well-known phenomenon that if we take the average of many observations of a random variable, the distribution converges to a normal distribution as the number of observations is increased. For example, if we throw two dice and calculate the sum of the random values that show on these dice each time, it will show a bell-shaped curve as the values that are measured will show the normal tendency. It is also observed that it will not show a perfect bell-shaped curve if it is done only 50 times, and it will show a good bell-shaped curve if ... Read More

Advertisements