Found 10784 Articles for Python

Python Program to insert an element into the array at the specified index

Gireesha Devara
Updated on 29-May-2023 15:22:04

2K+ Views

An array is a data structure, which is used to store the collection of homogeneous data elements. And each element in the array is identified by an index value. Arrays in python Python does not have its own data structure to represent an array. However, we can use the list data structure as an alternative to the arrays. Here we will use list an array − [10, 4, 11, 76, 99] Python provides some modules also which are more appropriate, and the modules are Numpy and array modules. A Numpy array defined by the NumPy module is − ... Read More

Python Program to get the flattened 1D array

Gireesha Devara
Updated on 29-May-2023 15:19:24

111 Views

An array is a data structure, which is used to store a set of homogeneous data elements. And it can have more than one dimension. 1D array − [1 2 3 4 5 6] 2D array − [[1 2 3] [4 5 6] [7 8 9]] Flattening an array means reducing the dimensionality of a Multi-dimensional array. In the article below we will discuss the python program to get the flattened 1D array. Here we will use List and NumPy arrays to represent a normal array. Because python does not have ... Read More

Python Program to find the distinct elements from two arrays

Gireesha Devara
Updated on 29-May-2023 15:15:46

2K+ Views

In programming, an array is a data structure that is used to store a collection of homogeneous data elements. And each element in the array is identified by a key or index value. Arrays in python Python doesn’t have a specific data type to represent arrays. Instead, we can use the List as an array. [1, 4, 6, 5, 3] Finding distinct elements from two arrays means, identifying the unique elements between the two given arrays. Input Output Scenarios Assume we have two arrays A and B with integer values. And the resultant array will have distinct elements ... Read More

Python Program to get the last given number of items from the array

Gireesha Devara
Updated on 29-May-2023 15:11:59

70 Views

An array is a data structure consisting of many elements with the same data type, and each element is identified by an index. [2, 4, 0, 5, 8] Arrays in Python Python does not have its own data structure to represent an array. However, we can use the list data structure as an alternative to the arrays. Here we will use list an array: [10, 4, 11, 76, 99] python provides some modules to work with arrays more appropriately which are Numpy, and array modules. In this article, we will see different ways to access the ... Read More

Python Program to get the first given number of items from the array

Gireesha Devara
Updated on 29-May-2023 15:07:35

74 Views

An array is a data structure of a set of items with the same data type, and each element is identified by an index. Arrays in python Python does not have its own data structure to represent an array. However, we can use the list data structure as an alternative to the arrays. Here we will use list an array − [10, 4, 11, 76, 99] Python provides some modules also which are more appropriate, and the modules are Numpy and array modules. An integer array defined by using the array module is − array('i', [1, 2, 3, ... Read More

Python Program to get the last item from the array

Gireesha Devara
Updated on 29-May-2023 15:05:29

94 Views

An array is a data structure, which is used to store collection of homogeneous data elements. And each element in the array is identified by an index value or key. Arrays in python Python doesn’t have a built-in data structure to represent arrays, but it has a built-in array module for work with arrays. And also we can use the NumPy package. An array defined by the array module is − array('i', [1, 2, 3, 4]) A Numpy array defined by the NumPy module is − array([1, 2, 3, 4]) Also, we can use the pythob list ... Read More

Python Program to remove the first given number of items from the array

Gireesha Devara
Updated on 29-May-2023 14:54:43

88 Views

An array is a data structure, which is used to store a set of elements of the same data type. And each element in the array is identified by an index value or key. Arrays in Python In Python doesn’t have a native array data structure. Instead, we can use List data structure to represent arrays. [1, 2, 3, 4, 5] Also we can use array or NumPy modules to work with arrays in python. An array defined by the array module is − array('i', [1, 2, 3, 4]) A Numpy array defined by the NumPy module ... Read More

Python Program to remove the last given number of items from the array

Gireesha Devara
Updated on 29-May-2023 14:46:48

88 Views

An array is a data structure, which is used to store a set of elements of the same data type. And each element in the array is identified by key or index value. Arrays in Python In Python doesn’t have a native data structure to represent arrays. However, we can use Lists to represent arrays. [1, 2, 3, 4, 5] Also we can use array or NumPy modules to work with arrays in python. An array defined by the array module is − array('i', [1, 2, 3, 4]) A Numpy array defined by the NumPy module ... Read More

How to Automate an Excel Sheet in Python?

Tarandeep Singh
Updated on 29-May-2023 12:38:16

2K+ Views

Data storage, analysis, and presentation are frequently done using Excel. The popular programming language Python, on the other hand, is renowned for its ease of use, adaptability, and versatility. For use with Excel spreadsheets and for various task automation, Python offers a number of libraries. We can easily make use of Python for automating Excel spreadsheets. For doing the same, we will be covering various approaches in this article: Approaches Using the openpyxl library Using the pandas library Using the xlwings library Method 1: Using the openpyxl library We can use the Python Openpyxl package for interacting with ... Read More

Get the day from a date in Pandas

Tarandeep Singh
Updated on 29-May-2023 12:35:40

8K+ Views

Pandas is a popular Python library that is used for data analysis and manipulation. Dealing with date and time is a common task while working with data analysis and manipulation in Python Pandas. Getting the day from a given date is a real-life task that might have come across many developers. This task is made easier by a number of functions and methods offered by Pandas. Knowing how to get the day from a date can be very helpful in many cases. In this article, we'll look at several methods for determining the day of the week in Pandas. You ... Read More

Advertisements