when I use the hist() from Pandas it produces a series of histograms for all the features in the dataset. I want to know how to extract/select/reference only one of the histograms returned by hist()?
For example, let'say I have the following code:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame({'X' : np.random.rand(100), 'Y': np.random.rand(100)})
df
df.hist()
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x00000150DAC658C8>,
<matplotlib.axes._subplots.AxesSubplot object at 0x00000150DB29AD48>]],
dtype=object)
I have tried slicing the array of matplotlib axes returned by the hist() method using [] (i.e. df.hist()[0]), but it does not extract only one plot but the two of them.
