Skip to content

io.loader

Bases: object

Apply a custom function to the data.

func: callable : Custom function to apply.

**

kwargs : Additional keyword arguments for the custom function.

data: pandas.DataFrame : The modified data.

Drop specified columns from the data.

columns: list : List of columns index or names to drop.

DatasetLoader : DatasetLoader object with the specified columns dropped.

Get the loaded data.

data: pandas.DataFrame : The loaded data.

Get descriptive columns from the data.

columns: list : List of descriptive columns.

data: pandas.DataFrame : DataFrame containing the descriptive columns.

Get metadata of the loaded data.

metadata: dict : Dictionary containing the number of subjects and variables.

import_data(data, columns=None, index=None, **kwargs)

Section titled “import_data(data, columns=None, index=None, **kwargs)”

Import data from a DataFrame or a array-like object.

data: pandas.DataFrame or array-like : Data to import.

columns: list, optional : List of columns to use. If None, all columns will be used.

DatasetLoader : DatasetLoader object with the imported data.

Join two DataFrames.

df: pandas.DataFrame : DataFrame to join with.

left: bool, optional : If true, provided DataFrame is the left DataFrame. If false, provided DataFrame is the right DataFrame. Default is True.

**

kwargs : Additional keyword arguments for the pd.concat function.

data: pandas.DataFrame : Joined DataFrame.

Load tabular data in any format (.txt, .csv, .xlsx).

file: str : Input file to load.

**

kwargs : Additional keyword arguments.

df: pandas.DataFrame

Reset the index of the DataFrame.

**

kwargs : Additional keyword arguments for the pd.DataFrame.reset_index function.

Save the data to a file.

file: str : Output file name.

**

kwargs : Additional keyword arguments.

Set the type of the specified columns.

dtype: str : Type to set.

columns: list, optional : List of columns to set the type for. If None, all columns will be converted.

data: pandas.DataFrame : DataFrame with the specified type set.

Transpose the data.

DatasetLoader : DatasetLoader object with the transposed data.

Bases: object

Add an edge attribute to the graph.

attribute: dict : Dictionary containing the values of the attribute for each edge.

Add a node attribute to the graph.

attributes: dict : Dictionary containing the values of the attribute for each node.

build_graph(data, source=‘source’, target=‘target’, **kwargs)

Section titled “build_graph(data, source=‘source’, target=‘target’, **kwargs)”

Build a graph from the provided data.

data: pandas.DataFrame : DataFrame containing the data to build the graph.

**

kwargs : Additional keyword arguments.

graph: networkx.Graph

Apply a custom function to the graph.

func: callable : Custom function to apply.

**

kwargs : Additional keyword arguments for the custom function.

graph: networkx.Graph : The modified graph.

Fetch nodes’ attributes from the graph as a DataFrame.

attributes: List, optional : List of attributes to fetch.

DatasetLoader : DatasetLoader object containing the nodes’ attributes.

Fetch edge data from the graph.

weight: str, optional : Edge attribute to use as weights for the edges.

DatasetLoader : DatasetLoader object containing the edge data.

Get the loaded graph.

graph: networkx.Graph : The loaded graph.

Get metadata of the loaded graph.

metadata: dict : Dictionary containing the number of nodes and edges.

layout(layout=NetworkLayout.Spring, weight=‘membership’, **kwargs)

Section titled “layout(layout=NetworkLayout.Spring, weight=‘membership’, **kwargs)”

Compute the layout of the graph. Parameters ———- layout: NetworkLayout

Layout algorithm to use.

weight: str, optional : Edge attribute to use as weights for the layout.

**

kwargs : Additional keyword arguments for the layout algorithm.

pos: dict : Dictionary containing the positions of the nodes.

Load graph data.

file: str : Input file to load.

**

kwargs : Additional keyword arguments.

graph: networkx.Graph

Save the graph data.

file: str : Output file to save.

**

kwargs : Additional keyword arguments.

visualize(output, weight=‘weight’, centroids_labelling=True, subjects_labelling=False, centroid_node_shape=500, centroid_alpha=1, centroid_node_color=‘white’, centroid_edge_color=‘black’, subject_node_shape=5, subject_alpha=0.3, subject_node_color=‘black’, subject_edge_color=None, edge_width_multiplier=10, colormap=‘plasma’, title=‘Graph Network’, legend_title=‘Membership values’)

Section titled “visualize(output, weight=‘weight’, centroids_labelling=True, subjects_labelling=False, centroid_node_shape=500, centroid_alpha=1, centroid_node_color=‘white’, centroid_edge_color=‘black’, subject_node_shape=5, subject_alpha=0.3, subject_node_color=‘black’, subject_edge_color=None, edge_width_multiplier=10, colormap=‘plasma’, title=‘Graph Network’, legend_title=‘Membership values’)”

Visualize the graph network.

output: str : Output file name.

weight: str, optional : Edge attribute to use as weights for the edges.

centroids_labelling: bool, optional : If true, label the centroid nodes.

subjects_labelling: bool, optional : If true, label the subject nodes.

centroid_node_shape: int, optional : Shape of the centroid nodes.

centroid_alpha: float, optional : Alpha value of the centroid nodes.

centroid_node_color: str, optional : Color of the centroid nodes.

centroid_edge_color: str, optional : Color of the centroid edges.

subject_node_shape: int, optional : Shape of the subject nodes.

subject_alpha: float, optional : Alpha value of the subject nodes.

subject_node_color: str, optional : Color of the subject nodes.

subject_edge_color: str, optional : Color of the subject edges.

colormap: str, optional : Colormap to use for the edges.

title: str, optional : Title of the plot.

legend_title: str, optional : Title of the legend.

Function to filter cluster nodes from subject’s nodes.

n : Node label.

bool : True or False

Function to filter subject nodes from cluster’s nodes.

n : Node label.

bool : True or False