Articles on Trending Technologies

Technical articles with clear explanations and examples

When do we use crosstab and pivot_table in Python Pandas?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 3K+ Views

In this article, we will explore when to use crosstab() and pivot_table() functions in Python Pandas. Both functions create summary tables, but they have different use cases and advantages. When to Use crosstab vs pivot_table The key difference lies in the input data format: pivot_table() - Use when you already have a DataFrame and want to reorganize it. You pass column names as strings to specify index, columns, and values. crosstab() - Use when you have separate array-like objects (lists, NumPy arrays, Series) that you want to cross-tabulate. No existing DataFrame required. In general, ...

Read More

Difference between data frames and matrices in Python Pandas?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 4K+ Views

In this article, we will explore the differences between DataFrames and matrices in Python Pandas. Both are 2-dimensional data structures, but they serve different purposes and have distinct characteristics. Both DataFrames and matrices are 2-dimensional data structures. In general, DataFrames can include multiple types of data (numeric, character, factor, etc) while matrices can only store one type of data. DataFrame in Python In Python, a DataFrame is a two-dimensional, tabular, mutable data structure that may store tabular data containing objects of various data types. A DataFrame has axes that are labeled in the form of rows and ...

Read More

How to select elements from Numpy array in Python?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 19K+ Views

In this article, we will show you how to select elements from a NumPy array in Python using indexing and slicing techniques. What is a NumPy Array? A NumPy array is a central data structure of the NumPy library. NumPy (Numerical Python) is a powerful library that provides high-performance multidimensional array objects for efficient scientific computing in Python. We can select elements from a NumPy array in several ways ? Selecting a single element using indexing Selecting a sub-array using slicing with start and stop values Selecting a sub-array with only stop value Selecting a ...

Read More

How to Flatten a Matrix using numpy in Python?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 4K+ Views

In this article, we will show you how to flatten a matrix using the NumPy library in python. numpy.ndarray.flatten() Function The numpy module includes a function called numpy.ndarray.flatten() that returns a one-dimensional copy of the array rather than a two-dimensional or multi-dimensional array. In simple words, we can say that it flattens a matrix to 1-Dimension. Syntax ndarray.flatten(order='C') Parameters order − 'C', 'F', 'A', 'K' (optional) When we set the order parameter to 'C', the array is flattened in row-major order. When the 'F' is set, the array is ...

Read More

How to display a variable as tooltip in ggplotly using R language?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 2K+ Views

R is a programming language for statistical computing and graphics. ggplotly() is a function used to convert static ggplot2 plots into interactive web-based plots. When creating interactive plots, you often want to display additional information when users hover over data points. This tutorial shows how to display variables as tooltips in ggplotly using R. Key Concepts To create custom tooltips, you'll use: aes() function for aesthetic mapping between visual cues and variables, including position (X and Y axes), color, fill, shape, line type, and size text aesthetic within aes() to define tooltip content ggplotly(tooltip = "text") ...

Read More

How to show multiple ggplot2 plots with Plotly using R?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 602 Views

R is a programming language for statistical computing and graphics. ggplotly() is a function that converts static ggplot2 plots into interactive web-based visualizations. When combined with facet_grid(), you can display multiple related plots in a single interactive dashboard. Prerequisites First, install the required R packages ? install.packages('ggplot2') install.packages('plotly') install.packages('dplyr') Method 1: Using facet_grid() with External Data This approach creates multiple plots by splitting data across different categories using facet_grid() ? library(ggplot2) library(plotly) library(dplyr) # Create sample student data students_data

Read More

How to remove option bar from ggplotly using R?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 614 Views

Looking at this article, I notice it's about R programming, not Python. The topic and content are completely focused on R's ggplotly function. This appears to be misclassified. However, I'll improve the HTML structure and formatting while keeping the R content intact. R is a programming language for statistical computing and graphics. ggplotly() is a function that converts a static ggplot to an interactive web-based version. ggplotly() returns a Plotly object that displays control options (ModeBar) by default. In this tutorial, we will see how to remove the option bar from ggplotly using R. Key Concept To ...

Read More

How to format mouse over labels using ggplotly in R?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 1K+ Views

**ARTICLE ISSUE NOTICE:** This article is about **R programming** (specifically ggplotly in R), not Python. The title and content focus entirely on R syntax, R packages (ggplot2, plotly, readr), and R-specific functions. However, the instructions specify this should be a **Python/Data Science** article. **RECOMMENDATION:** This article should either be: 1. **Moved to R tutorial section** (most appropriate) 2. **Completely rewritten** to cover Python equivalents (plotly.express, matplotlib, etc.) 3. **Replaced** with a different Python-focused topic **TECHNICAL ISSUES IN CURRENT ARTICLE:** - Code blocks incorrectly tagged as `language-python` when they contain R code - Missing proper R syntax highlighting ...

Read More

How to plot on secondary Y-Axis with Python Plotly?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 8K+ Views

Plotly is an open-source, interactive, and browser-based charting library for Python. Python users can use Plotly to generate different types of charts including scientific charts, 3D graphs, statistical charts, financial charts, etc. In this tutorial, we will show how you can use Plotly to plot data on the secondary Y-Axis. Here we will use the plotly.graph_objects module to generate figures. It contains a lot of methods to customize the charts and render them into HTML format. We will plot two bar charts using the add_trace() method and then use the update_layout() method to set a property with dict arguments. ...

Read More

How to add multiple text labels from DataFrame columns in Python Plotly?

Vani Nalliappan
Vani Nalliappan
Updated on 26-Mar-2026 3K+ Views

Plotly is a powerful Python library for creating interactive visualizations. You can add multiple text labels from DataFrame columns to enhance your charts with additional information that appears on hover or as annotations. In this tutorial, we'll learn how to create a scatter plot with text labels from different DataFrame columns using Plotly's graph_objects module. Required Libraries We'll use the following Python libraries ? plotly.graph_objects − For creating interactive plots pandas − For DataFrame operations plotly.offline − For generating HTML output Creating the DataFrame First, let's create a sample DataFrame with student ...

Read More
Showing 1–10 of 61,303 articles
« Prev 1 2 3 4 5 6131 Next »
Advertisements