Programming Articles - Page 351 of 3363

Python program to find common array elements

Nikhitha Chowdary Manne
Updated on 05-May-2023 16:51:35

296 Views

While considering the multi-dimensional arrays as an example, there is a method that is capable of finding the common elements present within a multi-dimensional array - intersection_update(). This method is used in order to find the common or intersecting elements present within the same array which is multi-dimensional in nature. Let us consider an input output scenario and then proceed with a program. Input Output Scenarios Consider a 2D array which is multi-dimensional in nature. arr = [[1, 2, 3, 4], [3, 4, 5, 6], [7, 8, 3, 4], [4, 9, 8, 3], [4, 3, 10, 12]] The ... Read More

Python Program to Concatenate Two Arrays

Nikhitha Chowdary Manne
Updated on 05-May-2023 16:50:40

13K+ Views

What is Concatenation of Arrays? The process of combining the arrays into a single array or merging the arrays into a single array is known as Concatenation of arrays. This mechanism can be done in many ways using several techniques. Let us discuss all techniques that help in concatenation of arrays in Python. Input Output Scenarios Consider three arrays to perform concatenation. arr1 = [“ Hello ”, “ World ”, “ My ”, “ Name ”, “ is ”, “ Python ”] arr2 = [“ Hello ”, “ World ”, “ My ”, “ Name ”, “ is ”, “ ... Read More

Python Program to Check if two arrays are equal

Nikhitha Chowdary Manne
Updated on 05-May-2023 16:49:27

22K+ Views

There are several techniques that helps us to check whether the given arrays are equal or not. The comparison of an array will not depend on the indices of the elements, it will only compare whether that particular element in one array is present in the other array or not. Let us discuss few techniques that compares two arrays and checks whether they are equal or not. There are several techniques that helps us to check whether the given arrays are equal or not. The comparison of an array will not depend on the indices of the elements, it will ... Read More

Drop rows in PySpark DataFrame with condition

Devesh Chauhan
Updated on 05-May-2023 13:27:10

2K+ Views

Applying conditions on a data frame can be very beneficial for a programmer. We can validate data to make sure that it fits our model. We can manipulate the data frame by applying conditions and filter out irrelevant data from the data frame which improves data visualization. In this article, we will perform a similar operation of applying conditions to a PySpark data frame and dropping rows from it. Pyspark offers real time data processing. It is an API of Apache spark which allows the programmer to create spark frameworks in a local python environment. Example Now that we ... Read More

Drop rows from the dataframe based on certain condition applied on a column

Devesh Chauhan
Updated on 05-May-2023 13:21:11

1K+ Views

In this article, we will discuss the different methods to drop rows from a data frame base on a one or multiple conditions. These conditions will be applied on the columns and the rows will be dropped accordingly. We will use pandas to create a data frame as it offers multiple functions to manipulate the data frame. We will also create a dataset which will act as a reference for the data frame although it is not mandatory to create one, we can also use a CSV file or any other document. Pandas support multiple file types including: “CSV”, ... Read More

Drop rows from Pandas dataframe with missing values or NaN in columns

Devesh Chauhan
Updated on 05-May-2023 13:19:35

5K+ Views

A dataset consists of a wide variety of values. These values can be a “string”, “integer”, “decimal” “Boolean” or even a “data structure”. These datasets are extremely valuable and can be used in various purposes. We can train model, interpret results, produce a hypothesis and build applications with the help a dataset. However, sometimes a dataset can contain values that are not necessary for our purpose. These values are called “NaN” (not a number). In this article, we will be dealing with these “NaN” or missing values. Our objective is to drop to those rows that contain any ... Read More

How to Get Int Type Random Number in Golang?

Siva Sai
Updated on 05-May-2023 11:56:29

4K+ Views

Generating random numbers is a common requirement in many programming applications. Golang offers built-in functionality to generate random numbers of different types. In this article, we will discuss how to generate random Int type numbers in Golang. What is Int Type? Int is a data type in Golang that represents an integer number. The size of the Int type depends on the architecture of the computer and can be either 32 or 64 bits. Int types are commonly used in programming applications for counting and indexing. Generating Random Int Type Numbers in Golang To generate a random Int type number ... Read More

Drop rows containing specific value in pyspark dataframe

Devesh Chauhan
Updated on 05-May-2023 13:15:20

1K+ Views

When we are dealing with complex datasets, we require frameworks that can process data quickly and provide results. This is where PySpark comes into the picture. PySpark is a tool which was developed by the Apache community to process data in real time. It is an API which is used to create data frames and interpret results in our local python environment. The data frame can contain huge amount of information/data and in order to maintain the relevance of the data to be interpreted we make the required changes. In this article, we will manipulate a PySpark data frame ... Read More

How to Get Float64 Type Random Number in Golang?

Siva Sai
Updated on 05-May-2023 11:56:12

2K+ Views

In Golang, generating random numbers is a common task that is required in many applications. However, the type of random number generated is important as it affects the precision and range of the number. In this article, we will discuss how to generate random Float64 type numbers in Golang. What is Float64 Type? Float64 is a data type in Golang that represents a floating-point number with 64 bits of precision. It is a double-precision floating-point format that can store values with a larger range and higher precision than a Float32 type. Float64 types are commonly used in scientific and engineering ... Read More

Drop One or Multiple Columns From PySpark DataFrame

Devesh Chauhan
Updated on 05-May-2023 13:11:28

1K+ Views

The PySpark data frame is a powerful, real time data processing framework which was developed by the Apache Spark developers. Spark was originally written in “scala” programming language and in order to increase its reach and flexibility, several APIs were built. These APIs provided an interface which can be used to run spark applications on our local environment. One such API is known as PySpark which was developed for the python environment. The PySpark data frame also consists of rows and columns but the processing part is different as it uses in-system (RAM) computational techniques for processing the data. ... Read More

Advertisements