1. Overview of astetik’s functionality

First let’s get some data (in this case 1000 tweets about Donald Trump. I’m using Somecode Twitter Research kit to get the data directly in to a pandas dataframe from Twitter API

import somecode as some
df = some.search("trump",100)
DataFrame with n=100 for keyword 'trump' created on 2016-11-13 10:45:58 succesfully withour errors.

1.1. List of Functions

  • Text (e.g. tweeets)
  • Descriptive Stats
  • Bars
  • Side-by-side Histogram
  • Bubble Chart (4 dimensions)
  • Heatmap Correlation (up to 40 variables)
  • Kernel Density Estimation
  • Swarming
  • OLS Regression test

1.2. Common function parameters

Because generally the user is required to spend much time to figure out basic configuration, such as titles, scales etc, astetik is focused on making frequently repeated operations as intuitive accessible as possible.

Example paramaters:

  • title / string to be used as a title for the graphic
  • suptitle / string to be used as subtitle for the graphic
  • xscale / for setting the scale of x axis (“linear”,”symlog”,”log”)
  • yscale / see above line
  • color / for changing a single color
  • palette / for changing a palette of colors (astetik is using Seaborn palettes but you could use any)

2. Examples of text and table presentation

The below examples highlight astetik’s functionality when used at the most basic level.

2.1. Tweets with most retweets

astetik.text(df,'text',5,sort_by='retweet_count')
RT @TheHashtag0nist: Joe: I hid all the pens from Trump Obama: Why? Joe: Because he bringing his own. Obama: ??? Joe: HE'S BRINGING HIS OWN…RT @PrisonPlanet: Trump supporters are being physically attacked in schools across America yet THIS is the story the media focuses on. http…RT @LoveCescMagic: Trump: Can I get past Biden: What's the password Trump: I don't know Biden: Losers says what Trump: What Obama: JOE http…RT @killfemme: In the middle of a Trump protest in Manhattan — so beautiful. https://t.co/ItKfmuOUwfRT @TheAnonnMessage: BREAKING NEWS: 100,000 protesters march on the streets of LA in a show of solidarity against Trump. #TrumpProtest http…

2.2. Negative tweets sorted by number of retweets

astetik.text(df[df.neg > 0.2],'text',"Negative tweets with many retweets",5,sort_by='retweet_count')

Negative tweets with many retweets

RT @_atypicalsgirls: Truly Inappropriate Trump Photo Gone Viral;;;; https://t.co/q32FShvc7nRT @_onlyfunnytweet: Truly Inappropriate Trump Photo Gone Viral;;;; https://t.co/78F3HyWRV2RT @memesuppIy: "Trump Won. Who's fucked?" https://t.co/5syr1gOy0g"Nuttall looks like a £ucking clown and doesn't even need the make up."  Lmao. Always worth reading the comments... https://t.co/I5TfjSeBR5RT @WildeThingy: Dear Donald Trump, please can you first build a wall round gorilla enclosures to keep the toddlers out. #NeverForget

Descritive statistics in a table

astetik.descriptive(df,['neg','neu','pos'],"Sentiment")

Sentiment


median mean std total
neg 0.06 0.09 0.11 93
neu 0.82 0.81 0.14 810
pos 0.0 -0.01 0.45 -6

OLS Regression Test

astetik.ols(df,'retweet_count','neg','neu','pos')
Independent Variable : retweet_count

OLS Summary


3. Examples of plot presentation

3.1. Side-by-side histograms

astetik.histogram(df,['quality_score','neu'])
_images/output_20_0.png

3.2. Horizontal bars for a single dimension of data

astetik.bars(df.location)
_images/output_22_0.png

3.3. Bubble chart for displaying 4 dimensions of data

astetik.bubble(df,'influence_score','reach_score','egg_account','retweet_count',xscale='symlog', yscale='symlog')
_images/output_24_0.png

3.4. Correlation heatmap for up to 30 variables

astetik.correlationt(df)
_images/output_26_0.png

3.5. Kernel Density Estimation

astetik.kde(df.influence_score,df.retweet_count,xscale="symlog",yscale="symlog")
_images/output_28_0.png

3.6. Swarming

astetik.swarm(df,'neg','retweet_count',yscale="symlog")
_images/output_30_0.png

4. Examples of general presentation

4.1. Toggle for hiding code cells

astetik.toggle()
toggle code cells
astetik.warning()

5. Using astetik in your next research project

pip install astetik
Read the Docs v: latest
Versions
latest
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.
coef t p_t std_error
Intercept -2144.4103 -0.451 0.6521 4754.7474
neg 4556.741 0.5101 0.6101 8933.8385
neu 5230.9289 1.0742 0.283 4869.404
pos -2045.194 -1.1611 0.2459 1761.4334