-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsights.py
More file actions
30 lines (22 loc) · 1.01 KB
/
insights.py
File metadata and controls
30 lines (22 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 11 21:19:23 2020
@author: Parashar
"""
import sqlite3
import pandas as pd
import matplotlib.pyplot as plt
db_conn = sqlite3.connect('auto-insta.db')
db_df = pd.read_sql("select * from instaDb", db_conn)
bot_df =pd.read_sql("select * from instaDb where bot_lead=1", db_conn)
bot_foll_df =pd.read_sql("select * from instaDb where bot_lead=1 AND following=1 AND acc_status=1", db_conn)
bot_fb_df=pd.read_sql("select * from instaDb where bot_lead=1 AND followers=1", db_conn)
hash_df = bot_foll_df.groupby(['hash_tag'],as_index=False).sum()
hash_df.sort_values("followers",ascending=False,inplace=True)
#bot_foll_df.plot(kind='bar',x='hash_tag',y='followers',color='red')
hash_df.plot(title="Most Followed hashtags", kind='bar',x='hash_tag',y='followers',color='red')
plt.show()
hash_df.to_csv("most_followed_hastags.csv",index=False)
bot_fb_df.plot(kind='scatter',x='following_cnt',y='followers_cnt',color='green')
plt.show()
bot_fb_df.to_csv("follow_back_users.csv",index=False)