Changes

Jump to navigation Jump to search
604 bytes added ,  18:55, 12 February 2022
m
Line 199: Line 199:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
=== Histogram ===
+
===Histogram===
 
<syntaxhighlight lang="python3">
 
<syntaxhighlight lang="python3">
 
import pandas as pd
 
import pandas as pd
Line 224: Line 224:  
plt.xlabel('Ages')
 
plt.xlabel('Ages')
 
plt.ylabel('Total Respondents')
 
plt.ylabel('Total Respondents')
 +
 +
plt.tight_layout()
 +
 +
plt.show()
 +
</syntaxhighlight>
 +
 +
=== Scatter plot ===
 +
<syntaxhighlight lang="python3">
 +
import pandas as pd
 +
from matplotlib import pyplot as plt
 +
 +
plt.style.use('seaborn')
 +
 +
data = pd.read_csv('2019-05-31-data.csv')
 +
view_count = data['view_count']
 +
likes = data['likes']
 +
ratio = data['ratio']
 +
 +
plt.scatter(view_count, likes, c=ratio, cmap='summer',
 +
            edgecolor='black', linewidth=1, alpha=0.75)
 +
 +
cbar = plt.colorbar()
 +
cbar.set_label('Like/Dislike Ratio')
 +
 +
plt.xscale('log')
 +
plt.yscale('log')
 +
 +
plt.title('Trending YouTube Videos')
 +
plt.xlabel('View Count')
 +
plt.ylabel('Total Likes')
    
plt.tight_layout()
 
plt.tight_layout()

Navigation menu