import pandas as pd
import numpy as np
df = pd.read_csv('test.csv')
df.head()
email
0 test1@test.com
1 test@test.com
2 test@testco.com
emails = df['email']
[parts[1] in parts[0] for parts in emails.str.split('[@.]')]
[True, True, False]
df.head()
email
0 test1@test.com
1 test@test.com
2 test@testco.com
import matplotlib
from paws.YuviPanda.replicahelper import sql
def namespace_edits(users, start, end, dbs):
    user_ids = ','.join([str(u) for u in users])
    namespaces = [0, 1, 2, 3]
    result = sql("""
       select count(wat.user_id) as edits
       from (select r.rev_user as user_id
               from revision_userindex r
                    inner join
                    page p      
                    on p.page_id = r.rev_page
              where r.rev_timestamp between :start and :end
                and r.rev_user_text in :user_ids
                and p.page_namespace in :namespaces

              union all

             select a.ar_user as user_id
               from archive_userindex a
              where a.ar_timestamp between :start and :end
                and a.ar_user_text in :user_ids
                and a.ar_namespace in :namespaces
            ) as wat
      group by user_id""", {
        'start': start,
        'end': end,
        'user_ids': users,
        'namespaces': namespaces
    }, dbs)
    for row in result:
        print(row)
from ipywidgets import interact_manual
@interact_manual
def edits(users='', wikis='enwiki_p'):
    namespace_edits(
        users.split(','), 
        '20060101000000', 
        '20161001000000', 
        wikis.split(',')
    )
os.environ['MYSQL_HOST']
'10.111.217.107'
import os
!dig -x 10.111.217.107
; <<>> DiG 9.10.3-P4-Ubuntu <<>> -x 10.111.217.107
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38169
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;107.217.111.10.in-addr.arpa.	IN	PTR

;; ANSWER SECTION:
107.217.111.10.in-addr.arpa. 30	IN	PTR	mysql.prod.svc.cluster.local.

;; Query time: 1 msec
;; SERVER: 10.96.0.10#53(10.96.0.10)
;; WHEN: Mon Nov 13 04:24:35 UTC 2017
;; MSG SIZE  rcvd: 87