This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
removed_by = grouped_df['removed_by'].tolist() | |
number_of_removed_posts = grouped_df['number_of_removed_posts'].tolist() | |
plt.figure(figsize=(12,8)) | |
plt.ylabel("Number of deleted reddits") | |
plt.bar(removed_by, number_of_removed_posts) | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
q1 = """SELECT removed_by, count(distinct id)as number_of_removed_posts | |
FROM df | |
where removed_by is not null | |
group by removed_by | |
order by 2 desc """ | |
grouped_df = ps.sqldf(q1, locals()) | |
grouped_df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df.info() | |
df.describe() #or df.count() | |
df.score.describe() | |
df.score.median() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = pd.read_csv('/kaggle/input/dataisbeautiful/r_dataisbeautiful_posts.csv') | |
df.head(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print(plt.style.available) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#plt.style.use('bmh') #setting up 'bmh' as "Bayesian Methods for Hackers" style sheet | |
plt.style.use('ggplot') #R ggplot style |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np #linear algebra | |
import pandas as pd #data processing | |
import seaborn as sns #statistical graph package | |
import matplotlib.pyplot as plt #plot package for visualisations | |
import pandasql as ps #sql package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
, NTILE(100) OVER (ORDER BY recruit_score DESC, share_score DESC, days_share_score DESC, channel_share_score DESC) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
, influence AS ( | |
SELECT user_id | |
, recruit_score | |
, share_score | |
, days_share_score | |
, channel_share_score | |
, NTILE(100) OVER (ORDER BY recruit_score DESC, share_score DESC, days_share_score DESC, channel_share_score DESC) | |
FROM ( | |
SELECT a.user_id |