makerhacks cross-posted this post in Programming & Dev 3 years ago


Use Python to Discover Your Biggest Fans

in #python3 years ago

image.png

Who is YOUR community?

This is not hypothetical if you want to grow a social account, a Hive presence, or a business.

Your community is a subset, so you can't say "Hive", "bloggers", or even "weekend bloggers over 50 years old" because that is your niche that you try to address, but they are not YOURs.

Judging Your Fans

On Hive we can quantify this in a couple of ways. The first would be who votes for you the most.

Now, of course, we had a Steem/Hive schism so that if we were being really correct about this I would filter out Steem from Hive, but for the sake of this exercise let's pretend that never happened!

Counting Votes

Here are my top 20 voters and how many votes they have made.

Yep, it is pretty clear I owe @themarkymark a case of beer or twenty.

themarkymark 422
rawpride 238
tpvoter1 220
buildawhale 217
upmyvote 211
share4every1 208
taukproung85 200
dmxmaster 186
sbi3 185
ipromote 171
bssman 155
abh12345.stem 149
enforcer48 144
mytechtrail 140
drmake 126
pbock 118
recoveryinc 109
yggdrasil.laguna 105
stemcur 89
stemisaria 87

How did I get this information? Via the magic of HiveSQL which I wrote a tutorial about previously.

This allows us to very quickly not just list all the votes on our blog, but also count them up, group them AND order the result!

select top(20) voter, count(voter) as votes
    from TxVotes where author='makerhacks' 
    group by voter order by votes desc

We translate this into:

  • Get only the top 20 results.
  • Return the voter name and the number of times that person voted as 'votes'.
  • From vote transactions.
  • Where they were voting on my post.
  • Group by voter name.
  • List with the biggest first.

Votes might be the most financially rewarding, but not be the best way to measure who is your biggest fan, though. What else is there?

Let's look at the data ...

Screen Shot 2022-01-17 at 4.55.20 PM.png

Comments, that looks promising!

Top Commenters

Gosh darn it there is Marky again. I am starting to think everyone here is two Marks in a trenchcoat ...

TOP COMMENTERS




















@themarkymark 104 @hivebuzz 53 @pbock 33 @steemmakers 33 @steemitboard 32 @mytechtrail 31 @enforcer48 29 @geekpowered 27 @drmake 26 @turkishcrew 26 @lextenebris 24 @postpromoter 24 @leaky20 22 @boucaron 21 @buildawhale 20 @ipromote 18 @netscape101 17 @steampunkkaja 15 @captainglondo 14 @chefbgob 14

In this case, the SQL is very much the same just with field names and tables changed:

select top(20) author, count(author) as comment_count 
from comments where parent_author='makerhacks' and not author='makerhacks' 
group by author order by comment_count desc;

We want all the comments where they were replying to something I wrote but the comment was not by me.

Reblogs?

On your account, you might look at who reblogs you the most, there is data for that. I thought I very rarely get reblogged but it seems there have been a lot more than I remember!

select top(10) account, count(account) as reblogged from reblogs where author='makerhacks' group by account order by reblogged desc;

Who Doesn't Like Me?

You could go the other way and see who has you muted ...

select * from mutes where muted='makerhacks';

Only 4 people have muted me? I must up my game! Hmm that means I can say what I like about them and they won't know, right? ;)




@marshmellowman @thepholosopher @tonygreene113 @mhsiemaszko

Over to You

What other interesting data can you find out? Please share with me in the comments!

Sort:  

nice one, im still new at python, hope i can advance my skill soon