Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Matplotlib
(edit)
Revision as of 19:32, 12 February 2022
604 bytes added
,
19:32, 12 February 2022
m
→Scatter plot
Line 255:
Line 255:
plt.xlabel('View Count')
plt.xlabel('View Count')
plt.ylabel('Total Likes')
plt.ylabel('Total Likes')
+
+
plt.tight_layout()
+
+
plt.show()
+
</syntaxhighlight>
+
+
=== Time Series ===
+
<syntaxhighlight lang="python3">
+
import pandas as pd
+
from datetime import datetime, timedelta
+
from matplotlib import pyplot as plt
+
from matplotlib import dates as mpl_dates
+
+
plt.style.use('seaborn')
+
+
data = pd.read_csv('data.csv')
+
+
data['Date'] = pd.to_datetime(data['Date'])
+
data.sort_values('Date', inplace=True)
+
+
price_date = data['Date']
+
price_close = data['Close']
+
+
plt.plot_date(price_date, price_close, linestyle='solid')
+
+
plt.gcf().autofmt_xdate()
+
+
plt.title('Bitcoin Prices')
+
plt.xlabel('Date')
+
plt.ylabel('Closing Price')
plt.tight_layout()
plt.tight_layout()
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version