Found 10784 Articles for Python

Check if a Column Starts/Ends with a given String in Pandas DataFrame

Mukul Latiyan
Updated on 02-Aug-2023 17:00:06

2K+ Views

Pandas is a popular Python library used for data manipulation and analysis. It provides powerful tools for working with structured data, such as tables or spreadsheets. Pandas can handle a variety of data formats, including CSV, Excel, SQL databases, and JSON, among others. One of the critical features of Pandas is its two primary data structures: Series and DataFrame. A Series is a one−dimensional array−like object that can hold any data type, such as integers, floating−point numbers, strings, or even Python objects. Series are labelled, meaning that they have an index that is used to access and manipulate the data. ... Read More

Change the View of Tensor in PyTorch

Mukul Latiyan
Updated on 02-Aug-2023 16:23:59

81 Views

PyTorch is an open−source machine learning library developed by Facebook's AI Research team. It is primarily used for deep learning applications, including natural language processing, computer vision, and reinforcement learning. PyTorch provides two main features: a multidimensional Tensor object and a collection of functions that operate on these Tensors. Torch The Tensor object in PyTorch is similar to NumPy's ndarray, but with added capabilities for utilizing GPUs and building dynamic computational graphs. These computational graphs are constructed on−the−fly during the execution of the program, allowing for efficient memory usage and more flexible model architectures. Additionally, PyTorch has a modular design ... Read More

How do we adjust the size of the plot in Seaborn?

Niharika Aitam
Updated on 02-Aug-2023 17:40:59

12K+ Views

The size of a plot refers to its width and height in units such as inches or centimeters. By adjusting the plot size, we can control how much space it occupies on the screen or in printed media. Seaborn provides several options for modifying the plot size to suit our needs. Seaborn does not have a specific parameter called "figure size" in its API. When using Seaborn to create plots, we can specify the figure size by directly manipulating the Figure object using Matplotlib's functions or parameters. Importing Required Libraries Before proceeding with the approaches, we have to make ... Read More

How to remove axes spine from the plot in seaborn?

Niharika Aitam
Updated on 02-Aug-2023 17:40:16

435 Views

The axes spines, also known as the axis lines, which are the lines that define the borders or boundaries of a plot's coordinate system. In a two-dimensional plot, there are typically four axes spines such as top, bottom, left, and right. These spines create the framework for the plot and serve as reference lines for the data points. Each spine represents one of the four sides of the plot. The top spine runs horizontally across the top, the bottom spine runs horizontally across the bottom, the left spine runs vertically along the left side, and the right spine runs vertically ... Read More

CMY and CMYK Color Models using Python

Niharika Aitam
Updated on 02-Aug-2023 17:38:23

1K+ Views

The CMY and CMYK color models are subtractive color models used in printing and graphic design. In Python, we can work with these color models using various libraries and tools. Let's see each color model in detail. CMY color model The CMY color model, also known as the subtractive color model, which is a system used for mixing colors in various applications like printing, painting, and graphic design. CMY stands for Cyan, Magenta, and Yellow, which are the primary colors in this model. In the CMY color model, colors are created by subtracting different amounts of cyan, magenta, and yellow ... Read More

Python - Check if a string matches regex list

Niharika Aitam
Updated on 02-Aug-2023 17:37:34

8K+ Views

A regular expression is also referred as regex, which is a sequence of characters that forms a search pattern. It's one of the powerful tools used for pattern matching and manipulating strings. In python we are having a module called re which helps to form a regular expression. Regex patterns consist of ordinary characters such as letters, digits and special characters called metacharacters. Meta Characters have special meanings and allow us to define complex search patterns. The below are some commonly used meta characters in python regular expressions. . (dot) − Matches any single character except a newline. ^ ... Read More

How to change the figure style to Ticks in Seaborn?

Niharika Aitam
Updated on 02-Aug-2023 17:36:39

490 Views

In Seaborn, the "ticks" figure style is a minimalistic style that removes the background grid lines but retains the tick marks on the axes. This style focuses on presenting the data without any distracting elements and is useful when we want a clean and simple look for our plots. When we set the figure style to "ticks" in Seaborn using the 'sns.set_style()' function, the following changes occur in our plots. Background Grid Lines − The background grid lines are removed, resulting in a blank canvas without any horizontal or vertical lines. This helps to reduce visual clutter and draw ... Read More

How to change the figure style to Dark in Seaborn?

Niharika Aitam
Updated on 02-Aug-2023 17:35:55

420 Views

In Seaborn, the figure style refers to the overall visual appearance and aesthetics of a plot. Seaborn provides several built-in figure styles that can be used to enhance the look and feel of your visualizations. These figure styles affect various elements such as colors, grid lines, background, fonts, and more. To set the figure style in Seaborn, we can use the sns.set_style() function. In this article we are going to see how to change the figure style to Dark in Seaborn. The following are the steps to be followed. Installing Seaborn Library First we have to ensure that Seaborn is ... Read More

What is the way to convert the figure style to Whitegrid in Seaborn?

Niharika Aitam
Updated on 02-Aug-2023 17:34:53

129 Views

Seaborn is a popular data visualization library in Python that provides a variety of styles to enhance the visual appearance of plots. One of the available styles is "whitegrid, " which offers a white background with grid lines. Changing the figure style in Seaborn is a straightforward process, and it can greatly impact the aesthetics of our visualizations. In this article we are going to see how to change the figure style to white Grid in seaborn. To change the figure style to "whitegrid" in Seaborn, we can follow below steps. Install Seaborn First we should check if we have ... Read More

How to change the figure style to Darkgrid in Seaborn?

Niharika Aitam
Updated on 02-Aug-2023 17:34:00

283 Views

Seaborn provides several built-in figure styles that we can choose from to enhance the visual appearance of our plots. These styles affect various elements such as colors, grid lines, background, and fonts. To set the figure style in Seaborn, we can use the sns.set_style() function. The following are the available figure styles in Seaborn library. Darkgrid − This style features a dark gray background with grid lines, which helps in focusing attention on the data points. Whitegrid − This style is similar to "darkgrid" but with a white background, making it suitable for plots with lighter color schemes. Dark ... Read More

Advertisements