Posts

Past 10 days activity heatmap on Hive and Leofinance. When are users active ? with python codes

avatar of @amr008
25
@amr008
·
·
0 views
·
3 min read

Good morning to everyone , hope you all are doing well . We are seeing a raise in price , a raise in activity and so much more on Hive Blockchain . I am sure many think about what's the best time to post on LeoFinance or Hive ? I was wondering about this too and thought of seeing when are people active ( in terms of posting and commenting ) on Hive .

Hive - posting + commenting data .

For some strange reason , HiveSQL wasn't working for me yesterday , I had to use Beem API to get the comment and posts data as well as voting data.

Important code snippets -

comment_list=[] 
vote_list=[] 
for op in b.stream(start=start1, stop=stop1, max_batch_size=50): 
    try: 
        if 'type' in op: 
            if(op['type']=='comment'): 
                comment_list.append(op) 
            elif op['type']=='vote': 
                vote_list.append(op) 
    except: 
        print(op)      

Everything ran smoothly , the code didn't enter the except clause .

What I am doing here is I am checking all the operations from 18th Feb to 27th Feb and storing the details in a list .

  1. Comment_list stores comment details
  2. Vote_list stores vote details
store_activity=[] 
c=0 
for i in range(0,len(comment_list)): 
    try: 
        json_app=json.loads(comment_list[i]['json_metadata']) 
        if 'app' in json_app: 
            store_activity.append([comment_list[i]['timestamp'],comment_list[i]['author'],json_app['app']]) 
    except: 
        store_activity.append([comment_list[i]['timestamp'],comment_list[i]['author'],'']) 
        c=c+1 
 
vote_activity=[] 
for i in range(0,len(vote_list)): 
    vote_activity.append([vote_list[i]['timestamp'],vote_list[i]['author'],vote_list[i]['weight']]) 

Then I go through each comment and store only three info

  1. Date
  2. Author
  3. App

For voting , I save the following info

  1. Date
  2. Author
  3. Weight

Now I will only post code for one dataframe -

df_activity=pd.DataFrame(store_activity,columns=['date','author','app']) 
hours=pd.to_datetime(df_activity['date']) 
df_activity['hours']=hours.dt.hour 
df_activity['date']=df_activity['date'].dt.date 
df_activity=df_activity.groupby(['hours','date']).count()['author'].to_frame() 
df_activity=df_activity.unstack(level=0) 
df_activity=df_activity.rename(columns={'author':'hour'}) 

To put it simple I am doing the following

  1. Create a new column hours
  2. Group the whole posts + comments based on date and hours
  3. Pivot the table

Then I have used seaborn to get the heatmap .

Heatmap - posts + comments - Hive

So this is how it looks ,

  1. The color intensity is directly proportional to the number of comments+ posts .

  2. The Lighter the color , the less activity .

  3. I have mentioned the hour in the top - 0,1,2,3 = all these are in UTC timings .

What do you observe from this ?

  1. The activity is less from 0-12 UTC when compared to 13-24 UTC . The evening ( in UTC timings ) is the busiest .

  2. The highest comments per hour we had ( past 10 days ) was on 22nd which is Monday .

    • Monday 22nd Feb 19-21 UTC saw almost 3000 comments+ posts on Hive .
  3. The minimum score was - 379 on Thursday 25th Feb at 4-5 UTC .

Can you observe anything else?

Heatmap - votes - hive

Well I initially thought the heatmap for posts+comments and the votes will be the same or similar , why?
Because of autovoting obviously but that isn't it , votes ( number of votes ) are more distributed throughout the day when compared to posting .

There is no huge difference when you see this .

What about just LeoFinance ?

Note- the below data is only for those posts and comments posted from LeoFinance front-end

  1. Well the 0-12 less activity and 13-24 more activity holds good here too.

  2. Monday which is 22nd has highest activity here too . Still the activity seems more distributed from 12-24 UTC when compared to Hive .

Update :

As @minus-pi pointed out - the above includes both first time posts/comments + edits ( since blockchain takes it as a new one ) . If I retreived from HiveSQL it would have retrieved only unique but since I used Beem API , both are retrieved ( new post + edits )

Although we may take the update to a post as an activity , it shouldn't be considered as +1 comment/ post . So here is the activity for posts and comments by not adding +1 when edited .

I checked the data and number of edits were 13k out of 172k . So I removed it and here is the update -

Hive posts/comments (without considering edits)

Leofinance posts/comments (without considering edits)

Well not much changes when we consider activity into count . Edits or no edits , its 99% similar.

Number of posts and number of votes per day

Number of posts per day ( and comments )

Number of votes per day

Number of posts and comments per day posted from Leofinance.io

Not bad at all huh?

Posted Using LeoFinance Beta