Skip to content

Instantly share code, notes, and snippets.

@mwmitchell
Created July 16, 2015 14:11
Show Gist options
  • Save mwmitchell/fc30399493ee1ee08f3d to your computer and use it in GitHub Desktop.
Save mwmitchell/fc30399493ee1ee08f3d to your computer and use it in GitHub Desktop.
much-fields.py
import csv
bigArray = []
fieldNameArray = []
sampleArray = []
theSize = 4000
for i in range(theSize):
fieldNameArray.append('Field_' + str(i))
for i in range(theSize):
sampleArray.append(i + 1)
bigArray.append(fieldNameArray)
for i in range(theSize):
bigArray.append(sampleArray)
with open('large.csv', 'wb') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
for i in bigArray:
spamwriter.writerow(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment