हिस्टोग्राम प्लॉट करना

Statistical Thinking in Python (Part 1)

Justin Bois

Teaching Professor at the California Institute of Technology

2008 US स्विंग स्टेट चुनाव परिणाम

Data.gov (https://www.data.gov/) से प्राप्त डेटा

ch1-2.003.png

Statistical Thinking in Python (Part 1)

हिस्टोग्राम बनाना

import matplotlib.pyplot as plt
_ = plt.hist(df_swing['dem_share'])
_ = plt.xlabel('percent of vote for Obama')
_ = plt.ylabel('number of counties')
plt.show()
Statistical Thinking in Python (Part 1)

हमेशा axes को लेबल करें

Statistical Thinking in Python (Part 1)

2008 US स्विंग स्टेट चुनाव परिणाम

Data.gov (https://www.data.gov/) से प्राप्त डेटा

ch1-2.013.png

Statistical Thinking in Python (Part 1)

अलग-अलग बिनिंग वाले हिस्टोग्राम

Data.gov (https://www.data.gov/) से प्राप्त डेटा

ch1-2.015.png

Statistical Thinking in Python (Part 1)

हिस्टोग्राम के बिन सेट करना

bin_edges = [0, 10, 20, 30, 40, 50,
                60, 70, 80, 90, 100]
_ = plt.hist(df_swing['dem_share'], bins=bin_edges)
plt.show()

ch1-2.022.png

Statistical Thinking in Python (Part 1)

हिस्टोग्राम के बिन सेट करना

_ = plt.hist(df_swing['dem_share'], bins=20)
plt.show()

ch1-2.027.png

Statistical Thinking in Python (Part 1)

Seaborn

  • माइकल वास्कॉम द्वारा लिखा गया Matplotlib-आधारित उत्कृष्ट सांख्यिकीय डेटा विज़ुअलाइज़ेशन पैकेज
Statistical Thinking in Python (Part 1)

Seaborn स्टाइलिंग सेट करना

import seaborn as sns
sns.set()
_ = plt.hist(df_swing['dem_share'])
_ = plt.xlabel('percent of vote for Obama')
_ = plt.ylabel('number of counties')
plt.show()
Statistical Thinking in Python (Part 1)

Seaborn-स्टाइल्ड हिस्टोग्राम

ch1-2.038.png

1 Data.gov (https://www.data.gov/) से प्राप्त डेटा
Statistical Thinking in Python (Part 1)

अभ्यास करते हैं!

Statistical Thinking in Python (Part 1)

Preparing Video For Download...