Instruction analysis framework
|
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. | |
Documentation for analysis tool.
None analysis_tool.add_df | ( | str | name, |
pd.DataFrame | df | ||
) |
Adds a new dataframe to the scope.
name | Name of the dataframe. |
df | Dataframe. |
int analysis_tool.df_len | ( | str | name | ) |
Returns length of the dataframe.
name | Name of the dataframe or its beginning. |
list[str] analysis_tool.dfs_list | ( | ) |
Returns a list of dataframe names in the scope.
pd.DataFrame analysis_tool.divide_into_categories | ( | str | name | ) |
Divides instructions in the dataframe into categories.
name | Name of the dataframe or its beginning. |
pd.DataFrame analysis_tool.divide_into_groups | ( | str | name | ) |
Divides instructions in the dataframe into groups.
name | Name of the dataframe or its beginning. |
pd.DataFrame analysis_tool.get_df | ( | str | name | ) |
Returns dataframe by name (or its beginning).
name | Name of the dataframe or its beginning. |
pd.DataFrame analysis_tool.head | ( | str | name, |
int | number_of_rows = 5 |
||
) |
Returns head of the dataframe.
name | Name of the dataframe or its beginning. |
number_of_rows | Number of rows in head. Default: 5. |
None analysis_tool.initialize_with_archives | ( | str | archives_folder, |
str | dataframes_dir | ||
) |
Unzips archives and loads dataframes to the scope.
archives_folder | Path to the folder with archives. |
dataframes_dir | Path to the folder in which unzipped dataframes will be placed. |
None analysis_tool.remove_df | ( | str | name | ) |
Returns dataframe by name (or its beginning).
name | Name of the dataframe or its beginning. |
pd.DataFrame analysis_tool.remove_filename_column | ( | str | name | ) |
Removes "filename" column from the dataframe.
name | Name of the dataframe or its beginning. |
None analysis_tool.show_df | ( | str | name, |
int | number_of_rows = 5 |
||
) |
Shows the dataframe.
name | Name of the dataframe or its beginning. |
number_of_rows | Number of rows to show. Default: 5. |
pd.DataFrame analysis_tool.sort_columns_by_sum | ( | str | name, |
bool | ascending = False |
||
) |
Sorts columns in the dataframe by its sums.
name | Name of the dataframe or its beginning. |
ascending | If True, the dataframe columns will be sorted in ascending order, otherwise - in descending order. Default: False. |
pd.DataFrame analysis_tool.top_popular | ( | str | name, |
int | n = 10 |
||
) |
Leaves in the dataframe top n most popular instructions.
name | Name of the dataframe or its beginning. |
n | Number of instructions. Default: 10. |
pd.DataFrame analysis_tool.top_rare | ( | str | name, |
int | n = 10 |
||
) |
Leaves in the dataframe top n the rarest instructions.
name | Name of the dataframe or its beginning. |
n | Number of instructions. Default: 10. |
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.
names | None or list of dataframe names (or their beginnings). If None, all dataframes in the scope will be used. Default: None. |
percent | If True, the histogram will be built by percentage, not by absolute values. Default: True. |
ascending | If True, the histogram columns will be sorted in ascending order, otherwise - in descending order. Default: False. |
width | Width of the histogram. Default: 2000. |
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.
names | None or list of dataframe names (or their beginnings). If None, all dataframes in the scope will be used. Default: None. |
percent | If True, the histogram will be built by percentage, not by absolute values. Default: True. |
ascending | If True, the histogram columns will be sorted in ascending order, otherwise - in descending order. Default: False. |
width | Width of the histogram. Default: 2000. |
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.
names | None or list of dataframe names (or their beginnings). If None, all dataframes in the scope will be used. Default: None. |
percent | If True, the histogram will be built by percentage, not by absolute values. Default: True. |
ascending | If True, the histogram columns will be sorted in ascending order, otherwise - in descending order. Default: False. |
width | Width of the histogram. Default: 2000. |
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.
name | Name of the dataframe or its beginning. |
to_dict | If True, function returns the result in the form of a dictionary. Default: True. |
show | Pretty print a result. Default: True. |
None analysis_tool.what_is_instruction | ( | str | instruction | ) |
Shows instruction information in a new tab (if such an instruction was found).
instruction | Instruction. |
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.
category | Category. |
name | Name of the dataframe or its beginning. |
divide_df | If True, function will divide instructions in the dataframe into categories. Default: True. |
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.
group | Group. |
name | Name of the dataframe or its beginning. |
divide_df | If True, function will divide instructions in the dataframe into groups. Default: True. |
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.
instruction | Instruction. |
name | Name of the dataframe or its beginning. |