audit-labs/audit-tools
A collection of scripts, queries, and other goodies you can use in an audit.
clone: git clone https://gitbay.org/audit-labs/audit-tools.git
d6b72187ad3ad53d1b77e7e13a4659b6311de0e4
verified · cmc
author: Christian Cleberg <hello@cleberg.net> · 2024-10-19T16:46:55Z
sampling/sample.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) @@ -1,8 +1,12 @@ +""" +Creates a sample from a CSV or Excel file based on user-defined SAMPLE_SIZE. +""" + # Import packages import pandas as pd # Define the sample size -sample_size = 25 +SAMPLE_SIZE = 25 # Import the data to a pandas DataFrame df = pd.read_csv("FILENAME_GOES_HERE.csv") @@ -15,8 +19,8 @@ df = pd.read_csv("FILENAME_GOES_HERE.csv") print("Dataframe size (rows, columns): ", df.shape) # Sample -sample = df.sample(sample_size) -print("Sample size: ", sample_size) +sample = df.sample(SAMPLE_SIZE) +print("Sample size: ", SAMPLE_SIZE) print("Sample:\n", sample) # ALTERNATIVE: Replacement Samples