Python: Two boxplots side by side WITH RAW DATA - python

Hi I am trying to make two boxplots that each show the raw data points inside the boxes. Here is the Pandas DataFrame I made alongside the boxplots I made that do not include the raw data This is the pd df
this is the plots i am trying to make

Related

Stacked bar chart in matplotlib without hardcoding the fields

I am trying to create a simple stacked bar chart using this data using ONLY matplotlib, pandas and numpy:
x-axis: Month
Labels: activity type
Height: distance
The examples I see, loop over the x-axis, but labels are always hard coded.
Can we loop over everything? In other words, can I create a chart without modifying this table:
No group by or pivot, just use the table as is and get the chart using matplotlib, pandas and numpy only (learning those at the moment)

Plotting a grouped stacked bar chart

I am trying to create a grouped, stacked bar chart. I was able to do it in excel and this image shows what I am trying to create but I want to do it through Python. I have all the data in a pandas data frame that is able to create separate stacked bar charts but I cannot get the grouping as seen in excel.
Excel Formatting:
If you could do it in Excel with easy then I strongly suggest you to do it with Excel. Unless you have other requirements.
There are many libraries you can use to create this type of plot: matplotlib, seaborn, or plotly. The one I use most is plotly. You can see the list of sample figures of plotly here: https://plotly.com/python/
Or you can join plotly community, there are many pros there might help with figure. I find there is few pros on figures in stackoverflow to plotly community: https://community.plotly.com/

How to modify my current data set in order to plot desired box plot using Seaborn?

I want to see the median as well as outliers using boxplot (seaborn). I want all boxes for all customers in a single plot . Example data looks like this:
Surveyed some drivers to capture how many times they press horn each day.
Data Set
The numbers represent the number of times horn was pressed.
I want to make boxplots for each customer to identify outliers. Actual data is quite big.
You can pass vectors of data represented as lists, numpy arrays, or pandas Series to the Seaborn boxplot function.
For example
import seaborn
import pandas as pd
import numpy as np
df = pd.read_csv("your.csv")
seaborn.boxplot(data=df)
This will result in the following figure.
An alternative would be df.boxplot() which will result in the following figure

Group Boxplots with multiple dataframes

I have tried to create a scatter with grouped boxplots as the ones on the following links:
matplotlib: Group boxplots
https://cmdlinetips.com/2019/03/how-to-make-grouped-boxplots-in-python-with-seaborn/
how to make a grouped boxplot graph in matplotlib
However, the data I want to use comes in a format as:
5y_spreads
7y_spreads
10y_spreads
(each of the images above comes from a different worksheet in the same workbook)
I need to work the data in Python to make it ready for seaborn and that is what is difficult for me.
It is not structured as in the examples from the links. I understand this requires mastering dataframes (something I am still learning).
I also need to show the latest value to see where the bonds are trading now, compared to the range.

Searching the annote data points in pandas

After this question Annotate data points while plotting from Pandas DataFrame where the points are annotated while plotting from pandas data frame. I want to search the annotate data points and show only the ones specified in the search and then update the plot with the result of the search. How do i do this ?

Categories