This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import shutil | |
| def flatten_directory(directory, delete_after=False): | |
| """ | |
| Flattens all folders in directory, deleting the empty folders after. | |
| **WARNING** | |
| This code WILL DELETE YOUR FILES | |
| if used naively. Seriously. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| def latex_two_column_table(title: str, l_caption: str, r_caption: str, l_df: pd.DataFrame, r_df: pd.DataFrame): | |
| """ | |
| Use to print out two-columned LaTeX code (or route into a file) for a set of dataframes | |
| """ | |
| l_df_tex = l_df.to_latex() | |
| r_df_tex = r_df.to_latex() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| def confusion_matrix(df: pd.DataFrame, col1: str, col2: str): | |
| """ | |
| Given a dataframe with at least | |
| two categorical columns, create a | |
| confusion matrix of the count of the columns | |
| cross-counts | |
| use like: |
NewerOlder