0

I'm trying to create an histogram made of data I got as homework. when I'm trying to plot it, values on the x axis are different (0.0-1.0) from those in the actual dataset (20,000 - 1,000,000). How do I get the range of actual values from my data to be displayed on the x axis of the histogram instead?

My code:

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.read_csv('okcupid_profiles.csv')
df = df[df['income'] != -1]

income_histogram = sns.distplot(df['income'], bins=40)
income_histogram

the histogram I've created

Thanks

Shuman_tov
  • 49
  • 3
  • You can use `ax = sns.distplot(...)` and then `ax.ticklabel_format(useOffset=False, style='plain', axis='y')`. Note that `sns.distplot` doesn't return a histogram, but a handle to the subplot on which it was drawn. Also note that in the latest seaborn versions `distplot` has been replaced by `histplot(...., kde=True)` – JohanC Apr 07 '21 at 18:09

1 Answers1

0

The values displayed in the x-axis are the same on the dataset, if you can see in the bottom right corner there is 1e6, that mean : 0.1 * 1e6 == 100,000