अपनी पहली टाइम सीरीज़ प्लॉट करें

Python में Time Series Data का विज़ुअलाइज़ेशन

Thomas Vincent

Head of Data Science, Getty Images

Matplotlib लाइब्रेरी

  • Python में, matplotlib डेटा प्लॉट करने के लिए एक व्यापक पैकेज है
  • matplotlib का pyplot सबमॉड्यूल आम तौर पर plt उपनाम से इम्पोर्ट किया जाता है
import matplotlib.pyplot as plt
Python में Time Series Data का विज़ुअलाइज़ेशन

टाइम सीरीज़ डेटा प्लॉट करना

आपकी पहली टाइम सीरीज़

Python में Time Series Data का विज़ुअलाइज़ेशन

टाइम सीरीज़ डेटा प्लॉट करना

import matplotlib.pyplot as plt
import pandas as pd

df = df.set_index('date_column')
df.plot()
plt.show()
Python में Time Series Data का विज़ुअलाइज़ेशन

अपने प्लॉट्स में स्टाइल जोड़ना

plt.style.use('fivethirtyeight')
df.plot()
plt.show()
Python में Time Series Data का विज़ुअलाइज़ेशन

FiveThirtyEight स्टाइल

fivethirtyeight स्टाइल का एक उदाहरण

Python में Time Series Data का विज़ुअलाइज़ेशन

Matplotlib स्टाइल शीट्स

print(plt.style.available)
['seaborn-dark-palette', 'seaborn-darkgrid', 
'seaborn-dark', 'seaborn-notebook', 
'seaborn-pastel', 'seaborn-white', 
'classic', 'ggplot', 'grayscale', 
'dark_background', 'seaborn-poster', 
'seaborn-muted', 'seaborn', 'bmh', 
'seaborn-paper', 'seaborn-whitegrid', 
'seaborn-bright', 'seaborn-talk', 
'fivethirtyeight', 'seaborn-colorblind', 
'seaborn-deep', 'seaborn-ticks']

Python में Time Series Data का विज़ुअलाइज़ेशन

लेबल्स से अपने ग्राफ़ समझाएँ

ax = df.plot(color='blue')
ax.set_xlabel('Date')
ax.set_ylabel('The values of my Y axis')
ax.set_title('The title of my plot')
plt.show()

अपने प्लॉट्स को लेबल करना

Python में Time Series Data का विज़ुअलाइज़ेशन

Figure size, linewidth, linestyle और fontsize

ax = df.plot(figsize=(12, 5), fontsize=12,
             linewidth=3, linestyle='--')
ax.set_xlabel('Date', fontsize=16)
ax.set_ylabel('The values of my Y axis', fontsize=16)
ax.set_title('The title of my plot', fontsize=16)
plt.show()

Python में Time Series Data का विज़ुअलाइज़ेशन

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

Python में Time Series Data का विज़ुअलाइज़ेशन

Preparing Video For Download...