In [2]:
%load_ext cypher
%matplotlib inline
import pandas as pd
In [2]:
%cypher match (n:tweet) return count(n)
Out[2]:
In [3]:
%cypher match (u:user) return count(u)
Out[3]:
In [4]:
%%cypher
match (n:tweet)-[r]-()
with n, count(r) as deg
order by deg desc
limit 10
match (n)<-[:TWEETS]-(u:user)
return u.screen_name as user, n.tid as tid, substring(n.text, 0, 20) as tweet, deg
Out[4]:
In [5]:
%%cypher
match (n:user)-[r]-()
return n.screen_name as user, count(r) as deg
order by deg desc
limit 10
Out[5]:
In [6]:
%%cypher
match (n:hashtag)-[r]-()
return n.hashtag as hashtags, count(r) as deg
order by deg desc
limit 10
Out[6]:
In [7]:
langs = %cypher match (n:tweet) where n.lang is not null return distinct n.lang, count(*) as num_tweets order by num_tweets desc
In [8]:
lang_df = langs.get_dataframe()
lang_df.set_index("n.lang")[:10].plot(kind="bar")
Out[8]:
In [9]:
%cypher match (n:tweet) return count(n)
Out[9]:
In [10]:
%cypher match (n:tweet) where n.coordinates is not null return count(n)
Out[10]:
In [12]:
6954 / 608049.0 # 1.1%
Out[12]:
In [13]:
countries = %cypher match (n:tweet) where n.coordinates is not null return distinct n.country, count(*) as num_tweets order by num_tweets desc
In [14]:
countries_df = countries.get_dataframe()
In [15]:
countries_df.set_index("n.country")[:20].plot(kind="bar")
Out[15]:
In [16]:
%cypher match (n:tweet) where n.lang = "en" return avg(n.polarity) as average_en_polarity
Out[16]:
In [17]:
%cypher match (n:tweet) where n.lang = "en" return avg(n.subjectivity) as average_en_subjectivity
Out[17]:
In [18]:
%cypher match (n:tweet) where n.lang = "fr" return avg(n.polarity) as average_fr_polarity
Out[18]:
In [19]:
%cypher match (n:tweet) where n.lang = "fr" return avg(n.subjectivity) as average_fr_subjectivity
Out[19]:
Louis_Tomlinson
In [27]:
%%cypher
match (u:user {uid: '84279963'})
return u.screen_name
Out[27]:
In [28]:
%%cypher
match (u:user {uid: '84279963'})-->(n:tweet)
return u.screen_name, n.text
Out[28]:
In [36]:
%%cypher
match (u:user {uid: '84279963'})<--(n:tweet)
return u.screen_name, n.text
Out[36]:
NiallOfficial
In [29]:
%%cypher
match (u:user {uid: '105119490'})
return u.screen_name
Out[29]:
In [32]:
%%cypher
match (u:user {uid: '105119490'})-->(n:tweet)
return u.screen_name, n.text
Out[32]:
In [35]:
%%cypher
match (u:user {uid: '105119490'})<--(n:tweet)
return u.screen_name, n.text
Out[35]:
RecherchesP
In [33]:
%%cypher
match (u:user {uid: '4185722537'})
return u.screen_name
Out[33]:
Harry_Styles
In [37]:
%%cypher
match (u:user {uid: '181561712'})
return u.screen_name
Out[37]:
In [38]:
%%cypher
match (u:user {uid: '181561712'})-->(n:tweet)
return u.screen_name, n.text
Out[38]:
In [39]:
%%cypher
match (u:user {uid: '181561712'})<--(n:tweet)
return u.screen_name, n.text
Out[39]:
infos140
In [40]:
%%cypher
match (u:user {uid: '1356382759'})
return u.screen_name
Out[40]:
In [41]:
%%cypher
match (u:user {uid: '1356382759'})-->(n:tweet)
return u.screen_name, n.text
Out[41]:
justinbieber
In [42]:
%%cypher
match (u:user {uid: '27260086'})
return u.screen_name
Out[42]:
In [45]:
%%cypher
match (u:user {uid: '27260086'})-->(n:tweet)
return u.screen_name, n.text
Out[45]:
In [46]:
%%cypher
match (u:user {uid: '27260086'})<--(n:tweet)
return u.screen_name, n.text
Out[46]:
nytimes
In [47]:
%%cypher
match (u:user {uid: '807095'})
return u.screen_name
Out[47]:
In [48]:
%%cypher
match (u:user {uid: '807095'})-->(n:tweet)
return u.screen_name, n.text
Out[48]:
AP
In [49]:
%%cypher
match (u:user {uid: '51241574'})
return u.screen_name
Out[49]:
In [50]:
%%cypher
match (u:user {uid: '51241574'})-->(n:tweet)
return u.screen_name, n.text
Out[50]:
jean_jullien 1851229334
In [51]:
%%cypher
match (u:user {uid: '1851229334'})
return u.screen_name
Out[51]:
Michael5SOS
In [52]:
%%cypher
match (u:user {uid: '403246803'})
return u.screen_name
Out[52]:
In [53]:
%%cypher
match (u:user {uid: '403246803'})-->(n:tweet)
return u.screen_name, n.text
Out[53]:
In [54]:
%%cypher
match (u:user {uid: '403246803'})<--(n:tweet)
return u.screen_name, n.text
Out[54]:
taylorswift13
In [56]:
%%cypher
match (u:user {screen_name: 'taylorswift13'})
return u.screen_name, u.uid
Out[56]:
In [57]:
%%cypher
match (u:user {uid: '17919972'})-->(n:tweet)
return u.screen_name, n.text
Out[57]:
In [3]:
%%cypher
match (u:user {uid: '17919972'})<--(n:tweet)<--(u2:user)
return u.screen_name, n.text, u2.screen_name
Out[3]:
In [ ]: