In [ ]:
# bot-vs-bot revert table: https://quarry.wmflabs.org/query/17237
!wget https://quarry.wmflabs.org/run/161084/output/0/tsv?download=true -O botvbot.tsv
In [1]:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
df = pd.read_csv("botvbot.tsv", sep="\t")
len(df)
Out[2]:
In [3]:
print(df.columns)
In [4]:
df[0:5]
Out[4]:
In [5]:
df['reverting_timestamp_dt'] = pd.to_datetime(df['reverting_timestamp'], format="%Y%m%d%H%M%S")
In [6]:
df = df.set_index('reverting_timestamp_dt')
In [7]:
df.page_namespace.value_counts()
Out[7]:
In [8]:
df.reverting_user_text.value_counts()
Out[8]:
In [9]:
len(df.reverting_user_text.value_counts())
Out[9]:
In [22]:
topbots = df.reverting_user_text.value_counts().index.tolist()[0:24]
topbots
Out[22]:
In [30]:
gp3 = df.groupby([pd.TimeGrouper('1D', closed='left'), 'reverting_user_text'])
In [31]:
user_namespace_g = gp3.rev_id.count()
user_namespace_g.head()
Out[31]:
In [32]:
user_namespace_g.unstack().head()
Out[32]:
In [33]:
user_namespace_unstack = user_namespace_g.unstack()[topbots]
In [34]:
fig, axes = plt.subplots(ncols=1,nrows=len(topbots), figsize=[14,28], sharex=True)
user_namespace_unstack[topbots].plot(subplots=True, kind='area', ax=axes)
fig.subplots_adjust(hspace=.25)
In [35]:
fig, axes = plt.subplots(ncols=1,nrows=len(topbots), figsize=[14,28], sharex=True, sharey=True)
user_namespace_unstack[topbots].plot(subplots=True, kind='area', ax=axes)
fig.subplots_adjust(hspace=.25)
In [ ]:
In [ ]:
In [36]:
user_namespace_unstack['Addbot'].plot(kind='area')
Out[36]:
In [37]:
user_namespace_unstack['AvicBot'].plot(kind='area')
Out[37]:
In [38]:
user_namespace_unstack['Xqbot'].plot(kind='area')
Out[38]:
In [39]:
user_namespace_unstack['KLBot2'].plot(kind='area')
Out[39]:
In [40]:
user_namespace_unstack['RussBot'].plot(kind='area')
Out[40]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: