sbutils package#

Submodules#

sbutils.LoadData module#

class sbutils.LoadData.LoadData(path_to_transaction_folder)[source]#

Bases: object

This class contain a set of methods to load data from the csv files The main one is create_df_tx which load all the transactions from the csv files

create_df_all_transactions(files, tx_chain, n_files=-1)[source]#

Create a dataframe with all transactions from a given chain. :param files: A list of files to load :type files: list :param tx_chain: The chain to load the transactions from. For example “ethereum” :type tx_chain: str :param n_files: The number of files to load. If -1, all files are loaded :type n_files: int

Returns:

df – A dataframe with all transactions from the given chain

Return type:

pd.DataFrame

create_df_tx(tx_chain, address_list=None, n_files=-1)[source]#

Create a dataframe with all transactions from a given chain. You can provide a list of addresses to filter the contributors. For example if you want to study the sybil of a given grant or project

Parameters:
  • tx_chain (str) – The chain to study. For example “ethereum”

  • address_list (list) – A list of addresses to filter the contributors

  • n_files (int) – The number of files to load. If -1, all files are loaded

Returns:

df – A dataframe with all transactions from the given chain

Return type:

pd.DataFrame

static get_address_name(file_name)[source]#

return the address name from the file name

static get_files(path, chain)[source]#

Get the list of files in a given path and chain :param path: The path to the folder containing the network folder :type path: str :param chain: The name of the chain to list the files of :type chain: str

Returns:

files – A list of files in the given path and chain

Return type:

list

get_files_in_address(chain, address_list)[source]#

Get the list of files in a given path and chain and that are in the address list :param chain: The name of the chain to list the files of :type chain: str :param address_list: A list of addresses to filter the contributors :type address_list: list

Returns:

files – A list of files in the given path and chain and filtered by the address list

Return type:

list

load_df_tx(file_name, tx_chain)[source]#

Load a dataframe with all transactions from a given file name and chain :param file_name: The name of the file to load :type file_name: str :param tx_chain: The chain to load the transactions from. For example “ethereum” :type tx_chain: str

Returns:

df – A dataframe with all transactions from the given file name and chain Adds a column with the EOA name

Return type:

pd.DataFrame

Module contents#