Instruction analysis framework
Loading...
Searching...
No Matches
Functions
analysis_tool Namespace Reference

Documentation for analysis tool. More...

Functions

None add_df (str name, pd.DataFrame df)
 Adds a new dataframe to the scope.
 
pd.DataFrame get_df (str name)
 Returns dataframe by name (or its beginning).
 
None show_df (str name, int number_of_rows=5)
 Shows the dataframe.
 
pd.DataFrame head (str name, int number_of_rows=5)
 Returns head of the dataframe.
 
None remove_df (str name)
 Returns dataframe by name (or its beginning).
 
int df_len (str name)
 Returns length of the dataframe.
 
pd.DataFrame remove_filename_column (str name)
 Removes "filename" column from the dataframe.
 
None initialize_with_archives (str archives_folder, str dataframes_dir)
 Unzips archives and loads dataframes to the scope.
 
list[str] dfs_list ()
 Returns a list of dataframe names in the scope.
 
None what_is_instruction (str instruction)
 Shows instruction information in a new tab (if such an instruction was found).
 
dict[str, int]|pd.DataFrame total_instruction_usage (str name, bool to_dict=True, bool show=True)
 Counts total instruction usage (sum of all values in each column) in the dataframe.
 
pd.DataFrame divide_into_categories (str name)
 Divides instructions in the dataframe into categories.
 
pd.DataFrame divide_into_groups (str name)
 Divides instructions in the dataframe into groups.
 
pd.DataFrame where_instruction (str instruction, str name)
 Leaves only those rows in which the instruction occurs a non-zero number of times.
 
pd.DataFrame where_category (str category, str name, bool divide_df=True)
 Leaves only those rows in which instructions of the category occur a non-zero number of times.
 
pd.DataFrame where_group (str group, str name, bool divide_df=True)
 Leaves only those rows in which instructions of the group occur a non-zero number of times.
 
pd.DataFrame sort_columns_by_sum (str name, bool ascending=False)
 Sorts columns in the dataframe by its sums.
 
pd.DataFrame top_popular (str name, int n=10)
 Leaves in the dataframe top n most popular instructions.
 
pd.DataFrame top_rare (str name, int n=10)
 Leaves in the dataframe top n the rarest instructions.
 
None total_histogram (list[str]|None names=None, bool percent=True, bool ascending=False, int width=2000)
 Builds a histogram of the total instruction usage in dataframes with the names given.
 
None total_categories_histogram (list[str]|None names=None, bool percent=True, bool ascending=False, int width=2000)
 Builds a histogram of the total instruction category usage in dataframes with the names given.
 
None total_groups_histogram (list[str]|None names=None, bool percent=True, bool ascending=False, int width=2000)
 Builds a histogram of the total instruction group usage in dataframes with the names given.
 

Detailed Description

Documentation for analysis tool.

Function Documentation

◆ add_df()

None analysis_tool.add_df ( str  name,
pd.DataFrame  df 
)

Adds a new dataframe to the scope.

Parameters
nameName of the dataframe.
dfDataframe.

◆ df_len()

int analysis_tool.df_len ( str  name)

Returns length of the dataframe.

Parameters
nameName of the dataframe or its beginning.
Returns
Length of the dataframe.

◆ dfs_list()

list[str] analysis_tool.dfs_list ( )

Returns a list of dataframe names in the scope.

Returns
List of dataframe names.

◆ divide_into_categories()

pd.DataFrame analysis_tool.divide_into_categories ( str  name)

Divides instructions in the dataframe into categories.

Parameters
nameName of the dataframe or its beginning.
Returns
Dataframe with instruction categories.

◆ divide_into_groups()

pd.DataFrame analysis_tool.divide_into_groups ( str  name)

Divides instructions in the dataframe into groups.

Parameters
nameName of the dataframe or its beginning.
Returns
Dataframe with instruction groups.

◆ get_df()

pd.DataFrame analysis_tool.get_df ( str  name)

Returns dataframe by name (or its beginning).

Parameters
nameName of the dataframe or its beginning.
Returns
Dataframe.

◆ head()

pd.DataFrame analysis_tool.head ( str  name,
int   number_of_rows = 5 
)

Returns head of the dataframe.

Parameters
nameName of the dataframe or its beginning.
number_of_rowsNumber of rows in head. Default: 5.
Returns
Head of the dataframe.

◆ initialize_with_archives()

None analysis_tool.initialize_with_archives ( str  archives_folder,
str  dataframes_dir 
)

Unzips archives and loads dataframes to the scope.

Parameters
archives_folderPath to the folder with archives.
dataframes_dirPath to the folder in which unzipped dataframes will be placed.

◆ remove_df()

None analysis_tool.remove_df ( str  name)

Returns dataframe by name (or its beginning).

Parameters
nameName of the dataframe or its beginning.

◆ remove_filename_column()

pd.DataFrame analysis_tool.remove_filename_column ( str  name)

Removes "filename" column from the dataframe.

Parameters
nameName of the dataframe or its beginning.
Returns
Dataframe without "filename" column.

◆ show_df()

None analysis_tool.show_df ( str  name,
int   number_of_rows = 5 
)

Shows the dataframe.

Parameters
nameName of the dataframe or its beginning.
number_of_rowsNumber of rows to show. Default: 5.

◆ sort_columns_by_sum()

pd.DataFrame analysis_tool.sort_columns_by_sum ( str  name,
bool   ascending = False 
)

Sorts columns in the dataframe by its sums.

Parameters
nameName of the dataframe or its beginning.
ascendingIf True, the dataframe columns will be sorted in ascending order, otherwise - in descending order. Default: False.
Returns
Dataframe with sorted columns.

◆ top_popular()

pd.DataFrame analysis_tool.top_popular ( str  name,
int   n = 10 
)

Leaves in the dataframe top n most popular instructions.

Parameters
nameName of the dataframe or its beginning.
nNumber of instructions. Default: 10.
Returns
: Dataframe with top n most popular instructions.

◆ top_rare()

pd.DataFrame analysis_tool.top_rare ( str  name,
int   n = 10 
)

Leaves in the dataframe top n the rarest instructions.

Parameters
nameName of the dataframe or its beginning.
nNumber of instructions. Default: 10.
Returns
Dataframe with top n the rarest instructions.

◆ total_categories_histogram()

None analysis_tool.total_categories_histogram ( list[str] | None   names = None,
bool   percent = True,
bool   ascending = False,
int   width = 2000 
)

Builds a histogram of the total instruction category usage in dataframes with the names given.

Parameters
namesNone or list of dataframe names (or their beginnings). If None, all dataframes in the scope will be used. Default: None.
percentIf True, the histogram will be built by percentage, not by absolute values. Default: True.
ascendingIf True, the histogram columns will be sorted in ascending order, otherwise - in descending order. Default: False.
widthWidth of the histogram. Default: 2000.

◆ total_groups_histogram()

None analysis_tool.total_groups_histogram ( list[str] | None   names = None,
bool   percent = True,
bool   ascending = False,
int   width = 2000 
)

Builds a histogram of the total instruction group usage in dataframes with the names given.

Parameters
namesNone or list of dataframe names (or their beginnings). If None, all dataframes in the scope will be used. Default: None.
percentIf True, the histogram will be built by percentage, not by absolute values. Default: True.
ascendingIf True, the histogram columns will be sorted in ascending order, otherwise - in descending order. Default: False.
widthWidth of the histogram. Default: 2000.

◆ total_histogram()

None analysis_tool.total_histogram ( list[str] | None   names = None,
bool   percent = True,
bool   ascending = False,
int   width = 2000 
)

Builds a histogram of the total instruction usage in dataframes with the names given.

Parameters
namesNone or list of dataframe names (or their beginnings). If None, all dataframes in the scope will be used. Default: None.
percentIf True, the histogram will be built by percentage, not by absolute values. Default: True.
ascendingIf True, the histogram columns will be sorted in ascending order, otherwise - in descending order. Default: False.
widthWidth of the histogram. Default: 2000.

◆ total_instruction_usage()

dict[str, int] | pd.DataFrame analysis_tool.total_instruction_usage ( str  name,
bool   to_dict = True,
bool   show = True 
)

Counts total instruction usage (sum of all values in each column) in the dataframe.

Parameters
nameName of the dataframe or its beginning.
to_dictIf True, function returns the result in the form of a dictionary. Default: True.
showPretty print a result. Default: True.
Returns
Dictionary or dataframe with total instruction usage.

◆ what_is_instruction()

None analysis_tool.what_is_instruction ( str  instruction)

Shows instruction information in a new tab (if such an instruction was found).

Parameters
instructionInstruction.

◆ where_category()

pd.DataFrame analysis_tool.where_category ( str  category,
str  name,
bool   divide_df = True 
)

Leaves only those rows in which instructions of the category occur a non-zero number of times.

Parameters
categoryCategory.
nameName of the dataframe or its beginning.
divide_dfIf True, function will divide instructions in the dataframe into categories. Default: True.
Returns
Dataframe with selected rows.

◆ where_group()

pd.DataFrame analysis_tool.where_group ( str  group,
str  name,
bool   divide_df = True 
)

Leaves only those rows in which instructions of the group occur a non-zero number of times.

Parameters
groupGroup.
nameName of the dataframe or its beginning.
divide_dfIf True, function will divide instructions in the dataframe into groups. Default: True.
Returns
Dataframe with selected rows.

◆ where_instruction()

pd.DataFrame analysis_tool.where_instruction ( str  instruction,
str  name 
)

Leaves only those rows in which the instruction occurs a non-zero number of times.

Parameters
instructionInstruction.
nameName of the dataframe or its beginning.
Returns
Dataframe with selected rows.