Found 33676 Articles for Programming

How to Convert HTML to Markdown in Python?

Mukul Latiyan
Updated on 18-Apr-2023 14:37:21

15K+ Views

Markdown is a lightweight markup language that allows you to write formatted text that can be easily read and understood on the web. On the other hand, HTML is a markup language used to structure and display content on the web. Converting HTML text to Markdown can be useful in situations where you want to simplify the content or make it more readable. One way to convert HTML to Markdown is by using the markdownify package in Python. This package provides a simple and efficient way to convert HTML text to Markdown format. To begin the conversion process, you need ... Read More

How to convert CSV File to PDF File using Python?

Mukul Latiyan
Updated on 18-Apr-2023 14:35:09

5K+ Views

In today's world, data is generated at an unprecedented rate, and being able to effectively manage and present it is essential. CSV files are commonly used to store and transfer data between systems, but sometimes it is necessary to convert this data into a more readable format such as PDF. Python, with its vast array of libraries, provides an easy and efficient way to convert CSV files to PDF files. In this article, we will explore the steps involved in converting a CSV file to a PDF file using Python, and provide a sample code that you can use to ... Read More

How to convert CSV columns to text in Python?

Mukul Latiyan
Updated on 18-Apr-2023 14:32:44

9K+ Views

CSV (Comma Separated Values) files are commonly used to store and exchange tabular data. However, there may be situations where you need to convert the data in CSV columns to text format, for example, to use it as input for natural language processing tasks. Python provides a variety of tools and libraries that can help with this task. In this tutorial, we will explore different methods for converting CSV columns to text in Python, including using the built-in CSV module, Pandas library, and regular expressions. We will also discuss how to handle different types of data and possible issues that ... Read More

How to convert categorical data to binary data in Python?

Mukul Latiyan
Updated on 18-Apr-2023 14:30:15

4K+ Views

Categorical data, also known as nominal data, is a type of data that is divided into discrete categories or groups. These categories have no inherent order or numerical value, and they are usually represented by words, labels, or symbols. Categorical data is commonly used to describe characteristics or attributes of objects, people, or events, and it can be found in various fields such as social sciences, marketing, and medical research. In Python, categorical data can be represented using various data structures, such as lists, tuples, dictionaries, and arrays. The most commonly used data structure for categorical data in Python is ... Read More

How to convert a NumPy array to a dictionary in Python?

Mukul Latiyan
Updated on 18-Apr-2023 14:25:44

8K+ Views

This tutorial provides a step-by-step guide on how to convert a NumPy array to a dictionary using Python. In NumPy, an array is essentially a table of elements that are typically numbers and share the same data type. It is indexed by a tuple of positive integers, and the number of dimensions of the array is referred to as its rank. The size of the array along each dimension is defined by a tuple of integers known as the shape of the array. The NumPy array class is known as ndarray, and its elements can be accessed by using square ... Read More

Formatting containers using format() in Python

Atharva Shah
Updated on 18-Apr-2023 12:41:33

271 Views

When using Python, container style can be a useful means of enhancing the readability and maintainability of code. You can style lists, tuples, dictionaries, sets, and even classes quickly and simply using this method. You can adjust how your data is presented by aligning columns, adding padding, and setting accuracy by using the built-in format() method. In this article, we'll take a deep dive into container formatting using format() in Python, including various types of containers and how to use them with the format() function. Container Formatting with format() Assuming we have a list of numbers that we want ... Read More

Emulating Numeric Types in Python

Atharva Shah
Updated on 18-Apr-2023 12:39:18

679 Views

Python includes built-in mathematical data structures like complex numbers, floating-point numbers, and integers. But occasionally we might want to develop our own custom-behaved number classes. Here, the idea of imitating number classes is put into use. We can create objects that can be used in the same way as native numeric classes by simulating them. We will look at how to simulate numeric classes in Python in this article. Example 1: Emulating Addition class MyNumber: def __init__(self, x): self.x = x def __add__(self, other): ... Read More

Element wise concatenation of two NumPy arrays of string

Atharva Shah
Updated on 18-Apr-2023 12:36:48

438 Views

Python's element-wise union of two NumPy string arrays is a potent method with a wide range of uses. This blog article will go over NumPy's setup and implementation procedures, the syntax for joining two NumPy string arrays together element-wise in Python, and the underlying method. Element-wise concatenation, for instance, is commonly used in data manipulation tasks to combine two data sets. Installation and Setup Simply use pip or conda. NumPy is a powerful library that provides support for mathematical operations and arrays. Once installed, you can import it into your Python script using the following command − import numpy ... Read More

Hashing Passwords in Python with BCrypt

Atharva Shah
Updated on 18-Apr-2023 12:42:33

12K+ Views

Password hashing is a technique used to store passwords securely. It involves converting plain text passwords into a hashed format that cannot be easily reversed or decrypted. By hashing passwords, even if a hacker gains access to the password database, they will not be able to decipher the passwords. BCrypt is a password hashing algorithm that is considered one of the most secure algorithms for password hashing in Python. BCrypt is designed to be slow, which makes it more difficult for hackers to crack the hashed passwords. In this post, we will explain the syntax, code algorithm, and Python ... Read More

Handling Categorical Data in Python

Atharva Shah
Updated on 18-Apr-2023 12:20:49

981 Views

Data that only includes a few values is referred to as categorical data, often known as categories or levels and it is described in two ways - nominal or ordinal. Data that lacks any intrinsic order, such as colors, genders, or animal species, is represented as nominal categorical data while ordinal categorical data refers to information that is naturally ranked or ordered, such as customer satisfaction levels or educational attainment. We will go through how to handle categorical data in Python in this tutorial. Setup pip install pandas pip install scikit-learn pip install category_encoders Categorical data is often ... Read More

Advertisements