Python Articles - Page 77 of 929

Filter Pandas DataFrame Based on Index

Jaisshree
Updated on 10-Aug-2023 15:19:43

644 Views

NumPy, which offers high-performance data manipulation and analysis capabilities, is the foundation for the Python package Pandas. It introduces the Series and DataFrame data structures. Any sort of data can be stored in a series, which is a one-dimensional labeled array. It is comparable to a column in a database table or spreadsheet. The Series object is labeled, which means each member has an associated index, making data access and manipulation quick and simple. Similar to a spreadsheet or a SQL table, a data frame is a two-dimensional tabular data structure made up of rows and columns. It is ... Read More

Python program to Swap i_th with j_th elements in List

Mrudgandha Kulkarni
Updated on 10-Aug-2023 15:26:38

294 Views

In Python, lists are versatile data structures that allow us to store and manipulate collections of items. There may be situations where we need to interchange or swap the positions of elements within a list. In this blog post, we will explore how to write a Python program to swap the i'th and j'th elements in a list. Understanding the Problem The task at hand is to develop a Python program that takes a list as input and swaps the positions of the i'th and j'th elements in the list. For example, given the list [1, 2, 3, 4, 5], ... Read More

Python Program to Swap dictionary item_s position

Mrudgandha Kulkarni
Updated on 10-Aug-2023 15:23:34

285 Views

Dictionaries in Python are versatile data structures that allow us to store and manipulate key-value pairs. While dictionaries maintain an unordered collection, there may be situations where we need to swap the positions of items within a dictionary. In this blog post, we will explore how to write a Python program to swap the positions of dictionary items. Understanding the Problem The task at hand is to develop a Python program that takes a dictionary as input and swaps the positions of its items. For example, given the dictionary my_dict = {'A': 1, 'B': 2, 'C': 3}, the program should ... Read More

FileExtensionValidator – Validate File Extensions in Django

Jaisshree
Updated on 10-Aug-2023 15:16:22

1K+ Views

Developers can rapidly and simply design web apps using the high-level Python web framework Django. A complete collection of tools and libraries is provided for creating web applications, and it adheres to the Model-View-Controller (MVC) architectural paradigm. Why is Django used in Python? From modest personal endeavours to extensive commercial solutions, Django is used to create all kinds of web applications. The construction of intricate, data-driven websites, including the social networking sites such as instagram, e-commerce platforms, and content management systems, is where it excels. Numerous functions are available out of the box with Django, such as URL ... Read More

Python Program to Square Each Odd Number in a List using List Comprehension

Mrudgandha Kulkarni
Updated on 10-Aug-2023 15:22:09

1K+ Views

List comprehension is a powerful feature in Python that allows for concise and expressive code when working with lists. It provides a compact way to perform operations on elements of a list and create new lists based on certain conditions. In this blog post, we will explore how to use list comprehension to square each odd number in a list. Understanding the Problem The task at hand is to write a Python program that takes a list of numbers as input and squares each odd number in the list. For example, given the list [1, 2, 3, 4, 5], the ... Read More

Python Program to split string into k sized overlapping strings

Mrudgandha Kulkarni
Updated on 10-Aug-2023 15:06:40

613 Views

Splitting a string into smaller parts is a common task in many text processing and data analysis scenarios. In this blog post, we will explore how to write a Python program to split a given string into k-sized overlapping strings. This program can be helpful when working with sequences of data where overlapping segments are needed for analysis, feature extraction, or pattern recognition. Understanding the Problem Before diving into the implementation details, let's define the requirements of our program. We need to develop a Python solution that takes a string as input and splits it into k-sized overlapping strings. For ... Read More

Fibonacci Search Visualizer using PyQt5

Jaisshree
Updated on 10-Aug-2023 14:47:35

361 Views

Sorting of lists help us in solving sort huge amount data and various mathematical and logical problems in a very less time. We can find a particular element in a sorted list easily with the help of Fibonacci search method. Here, we will create a Fibonacci Search Visualiser using a PyQt5 module in Python. Example  In this example, we have used a Fibonacci visualizer's user interface that consists of a window with a list of fibonacci numbers and display the result. The following PyQt5 widgets are used in this code: QListWidget QLineEdit QPushButton ... Read More

Fernet (Symmetric Encryption) using a Cryptography Module in Python

Jaisshree
Updated on 10-Aug-2023 14:39:28

5K+ Views

Symmetric encoding is a cryptographic technique, where the same key is used for both encryption and decryption of messages from client to server. In order to ensure no sensitive information is leaked while passing the network packets through vulnerable servers, where hackers may use this message for malicious intent, encrypting the message will be a good idea. There are some steps followed in symmetric encryption: Key generation: For both the client and server, in order to access the message, a secret key is generated first and sent to the receiver in order to decrypt ... Read More

Difference Between Tensor and Variable in Pytorch

Jaisshree
Updated on 10-Aug-2023 14:34:00

369 Views

PyTorch is an open-source Python library used for machine learning, computer vision and deep learning. It is an excellent library to build neural networks, conduct complex computations and optimise gradient differentiation. Developed by Facebook's Research Team (FAIR), it gained popularity due to its dynamic computing graphs, allowing it to change graphs in real time. This was revolutionary back in 2016 when models working in real-time just started to pop off. There are two main variables which will be focused on, tensor and variable in PyTorch. Tensor is used to define an n-dimension matrix or multi-dimensional ... Read More

Difference between str.capitalize() vs str.title()

Jaisshree
Updated on 10-Aug-2023 14:30:27

869 Views

In Python, String is a sequence of characters surrounded by either double quotes(" ") or single quotes (' '). Strings are used to represent text data in Python and it can contain letters, numbers, and symbols. String data type is immutable in Python, that is once a string instance is created it's value cannot be changed. But a new string with the required changes made in the original string can be created. Python Strings come with numerous methods like capitalize(), upper(), title(), split(), strip(), join(), etc. that can also be used to manipulate strings. str.capitalize() ... Read More

Advertisements