Last active
August 6, 2024 20:36
-
-
Save Intelrunner/af487c7e92e96cb5dde43526c3373918 to your computer and use it in GitHub Desktop.
Builds a 1.3GB file full of random values. Used for testing transfer speeds. Update the # of rows to make a even chonkier file.
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
# This is not an original work, but crafted based on: https://gist.github.com/momota/ba302f0f0720ff5b2445fb81820c5b82 | |
# I updated it to make a file closer to the size I needed consistantly. All praise goes to: @momota and @andrewFarley for | |
# The original gist. | |
import csv | |
import random | |
# 1000000 and 62 == roughly 1.3GB (will take a bit of time, go get a coffee) | |
rows = 1200000 | |
columns = 62 | |
def generate_random_row(col): | |
a = [] | |
l = [i] | |
for j in range(col): | |
l.append(random.random()) | |
a.append(l) | |
return a | |
if __name__ == '__main__': | |
f = open('sample.csv', 'w') | |
w = csv.writer(f, lineterminator='\n') | |
for i in range(rows): | |
w.writerows(generate_random_row(columns)) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment