<jupyter_start><jupyter_text>Import packages<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns<jupyter_output><empty_output><jupyter_text>Set inline<jupyter_code>%matplotlib inline<jupyter_output><empty_output><jupyter_text>Import CSV to dataframe<jupyter_code>filename = 'export_dummy.csv'
df = pd.read_csv(filename, index_col=0)
df.head()
df[['entities.hashtags', 'bot_status', 'bot_ori_status']].head()
sns.distplot(df['bot_status'])<jupyter_output><empty_output><jupyter_text>Set 0.6 as the threshold of robot or human. Above 0.6 is bot and below 0.6 is human.<jupyter_code>bot_count = len(df[df['bot_status'] > 0.6])
bot_ori_count = len(df[df['bot_ori_status'] > 0.6])

human_count = len(df) - bot_count
human_ori_count = len(df) - bot_ori_count<jupyter_output><empty_output><jupyter_text>This is pie chart showing the comparison between bot and human who tweet and discuss about brexit<jupyter_code>bot_vs_human_labels = ['Bot', 'Human']
bot_vs_human_data = [bot_count, human_count]
colors = ['lightskyblue', 'gold']

plt.pie(bot_vs_human_data, 
        labels = bot_vs_human_labels,
        colors = colors,
        autopct = '%1.1f%%',
        shadow = True,
        startangle = 0)
plt.axis('equal')
plt.show()<jupyter_output><empty_output><jupyter_text>This is pie chart showing comparison between bot and human who got retweeted in brexit discussion<jupyter_code>bot_vs_human_labels = ['Retweeted Bot', ' Retweeted Human']
bot_vs_human_data = [bot_ori_count, human_ori_count]
colors = ['lightskyblue', 'gold']

plt.pie(bot_vs_human_data, 
        labels = bot_vs_human_labels,
        colors = colors,
        autopct = '%1.1f%%',
        shadow = True,
        startangle = 0)
plt.axis('equal')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12035496394897394, 'fraction_numerical': 0.009428729894620078, 'mean_word_length': 5.681481481481481, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '169098', 'license': 'MIT', 'n_tokens_mistral': 671, 'n_tokens_neox': 654, 'n_words': 134, 'path': '3rd_Assignment/Analysis/Bot vs Human Comparison.ipynb', 'repo_name': 'indralukmana/twitter-brexit', 'size': '1803'}