histogram

How to plot medians of grouped data in pandas

How to plot medians of grouped data in pandas Question: Considering two histograms as the following ones: from pandas import DataFrame import numpy as np x = [‘A’]*300 + [‘B’]*400 y = np.random.randn(700) df = DataFrame({‘Letter’: x, ‘N’: y}) df.hist(‘N’, by=’Letter’) I am trying to plot the median of each grouped data. I would also …

Total answers: 1

How to plot from table with multiple histograms?

How to plot multiple histograms from a dataframe Question: I have a table with following format: df = pd.DataFrame({‘Bins’: [‘Bin1′,’Bin2′,’Bin3’], ‘hist_A’: [10,5,10], ‘hist_B’: [1,5,6], ‘hist_C’: [1,8,6]}) Where the values are the ‘weights’ or ‘frequency/counts’. How can I plot these histograms in one Seaborn displot() with ‘hue’ and ‘col’ faceting? Asked By: mrLimpio || Source Answers: …

Total answers: 2

Get a list of lists of elements in each bin of a 2D histogram

Get a list of lists of elements in each bin of a 2D histogram Question: I’m working with 2D data, and I’m aware of how to bin the data to form a 2D histogram using np.histogram2d, and also how to find the bin-location of a particular element using np.digitize. The code I use to find …

Total answers: 1

Error message 'Data frame name not defined' when plotting histogram in python

Error message 'Data frame name not defined' when plotting histogram in python Question: I want to plot a histogram for all numerical columns in my data frame. An error message keeps on coming up saying my data frame name (Cab_Data) is not defined. I have installed and imported matplotlib as plt, I used the code …

Total answers: 2

Matplotlib stacked and grouped histogram

Matplotlib stacked and grouped histogram Question: I’m trying to compare 2 datasets with a histogram. I have a pandas dataframe which contains 3 columns: username (cleaned for anonymity), a series of lists of time frequency data, and a type column. My goal is to make a grouped histogram with the goal of comparing the 2 …

Total answers: 1

How to set order of x-axis on sns histplot?

How to set order of x-axis on sns histplot? Question: The ‘floorType’ was originally character variable that I changed into integer (1,2,3,4,5) through Excel. But when I loaded that cvs. file into Jupyter and draw sns histogram of this variable, the order of axis is shown as (4 -> 5 -> 3 -> 2 -> …

Total answers: 1

Histogram for list of elements python

Histogram for list of elements python Question: Does anybody know how I can make this Input Explanation: <2> is the first input and shows the number of next inputs lines -> if the first input is n all the input lines are n+1 2 purple 11,yellow 3,pink 1 gray 8,blue 10,pink 12 and the last …

Total answers: 2

How to plot histogram for a dataframe

How to plot histogram for a dataframe Question: I need to plot a row of a dataframe on a histogram so that the x-axes have the number of columns in the x-axes and the ordinates have their values. An example of my data data = [1.7,1.8,2.0,3.2] In the x-axes I would like numbers from one …

Total answers: 1

Find the index of elements calssified in each bin of histogram

Find the index of elements calssified in each bin of histogram Question: I want to create a histogram using one column of my data and then find what is the index of elements classified in each bin. The sample table is as follows: name n_7 n_6 a 20 11 b 14 50 c 18 21 …

Total answers: 1

How do I create histograms for all variables except one in Python?

How do I create histograms for all variables except one in Python? Question: df.hist() gives you histograms for all variables. df.hist(column=’age’) gives you a histogram for just age. What if I want histograms for all variables except one? Do I have to do them separately? And what’s the difference between using df.hist() and the Matplotlib …

Total answers: 2