Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
csotomon committed May 8, 2021
1 parent 59026f9 commit 3d7278a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
sys.path.insert(0, os.path.abspath('../../src'))


# -- Project information -----------------------------------------------------

project = 'PyCooRnet'
copyright = '2020, PyCooRnet Developers'
copyright = '2021, PyCooRnet Developers'
author = 'PyCooRnet Developers'


Expand Down Expand Up @@ -53,4 +53,4 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']
8 changes: 3 additions & 5 deletions src/pycoornet/crowdtangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
class CrowdTangle:
"""Descripción de la clase.
:param api_key: CrowdTangle API key.
:type api_key: string
api_key (str): CrowdTangle API key.
"""

def __init__(self, api_key):
Expand All @@ -29,7 +28,7 @@ def get_shares(self, urls, url_column='url', date_column='date', platforms=('fac
""" Get the URLs shares from CrowdTangle from a list of URLs with publish datetime
Args:
urls (dataframe): a dataframe with at least a column "url" containing the URLs, and a column "date" with their published date
urls (pandas.DataFrame): a dataframe with at least a column "url" containing the URLs, and a column "date" with their published date
url_column (str, optional): name of the column (placed inside quote marks) where the URLs are stored. Defaults to 'url'.
date_column (str, optional): name of the column (placed inside quote marks) where the date of the URLs are stored. Defaults to 'date'.
platforms (tuple, optional): a tuple of platforms to search. You can specify only facebook to search on Facebook, or only instagram to
Expand All @@ -48,8 +47,7 @@ def get_shares(self, urls, url_column='url', date_column='date', platforms=('fac
SystemExit: [description]
Returns:
[pandas.Dataframe]: [A pandas dataframe of posts that shared the URLs and a number of variables returned by the https://github.com/CrowdTangle/API/wiki/Links
CrowdTangle API links endpoint and the original data set of news.
pandas.DataFrame: A pandas dataframe of posts that shared the URLs and a number of variables returned by the https://github.com/CrowdTangle/API/wiki/Links CrowdTangle API links endpoint and the original data set of news.
"""

try:
Expand Down
19 changes: 8 additions & 11 deletions src/pycoornet/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ class Shared:
Args:
crowdtangle_shares_df (pandas.DataFrame): the pandas dataframe of link posts resulting from the function
CrowdTangle shares
Returns:
2-elementos tuple containing
- **graph** (networkx.Graph): An graph (highly_connected_g) with networks of coordinated entities whose edges also contains a t_coord_share attribute (vector) reporting the timestamps of every time the edge was detected as coordinated sharing.
- **q** (float): Percentile edge weight number of leeped repetedly coordinated link sharing.
"""
def __init__(self, crowdtangle_shares_df):
self.__crowdtangle_shares_df = crowdtangle_shares_df
Expand All @@ -45,9 +41,10 @@ def estimate_coord_interval(self, q=0.1, p=0.5, clean_urls=False, keep_ourl_only
keep_ourl_only (bool, optional): restrict the analysis to CrownTangle shares links matching the original URLs. Defaults to False.
Returns:
2-element tuple containing
- **summary** (pandas.DataFrame): summary statistics of q\% quickest second share performing URLs.
- **coordination interval** (integer): time in seconds corresponding to the median time spent by these URLs to cumulate the % of their total shares.
(tuple): 2-element tuple containing
- **summary** (pandas.DataFrame): summary statistics of q\% quickest second share performing URLs.
- **coordination interval** (integer): time in seconds corresponding to the median time spent by these URLs to cumulate the % of their total shares.
"""
if 0<p<1 == False:
logger.error('The p value must be between 0 and 1')
Expand Down Expand Up @@ -279,11 +276,11 @@ def coord_shares(self, coordination_interval=None, percentile_edge_weight=90, cl
Slow on large networks. Defaults to False.
Returns:
3-element tuple containing
(tuple): 3-element tuple containing
- **coordinated_df** (pandas.DataFrame): The input dataframe of shares with an additional boolean variable (coordinated) that identifies coordinated shares.
- **graph** (networkx.Graph): An graph (highly_connected_g) with networks of coordinated entities whose edges also contains a t_coord_share attribute (vector) reporting the timestamps of every time the edge was detected as coordinated sharing.
- **q** (networkx.Graph): Percentile edge weight number of leeped repetedly coordinated link sharing.
- **coordinated_df** (pandas.DataFrame): The input dataframe of shares with an additional boolean variable (coordinated) that identifies coordinated shares.
- **graph** (networkx.Graph): An graph (highly_connected_g) with networks of coordinated entities whose edges also contains a t_coord_share attribute (vector) reporting the timestamps of every time the edge was detected as coordinated sharing.
- **q** (networkx.Graph): Percentile edge weight number of leeped repetedly coordinated link sharing.
"""
# estimate the coordination interval if not specified by the users
dataframe = self.__crowdtangle_shares_df.copy(deep=True)
Expand Down
2 changes: 1 addition & 1 deletion src/pycoornet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def clean_urls(dataframe, url_column):
Args:
dataframe (pandas.DataFrame): the pandas dataframe of link posts
url_column (string): the name of the dataframe column with the urls
url_column (str): the name of the dataframe column with the urls
Returns:
pandas.DataFrame: the dateframe with the cleaned urls
Expand Down

0 comments on commit 3d7278a

Please sign in to comment.