Skip to main content

For generating specific CSVs for testing data piplines

Project description

RandomCSV

This library let's you generate CSV files with a specific structure, but random data. These CSVs can be used as test data when developing data pipelines.

Usage

from randomcsv import *


generator = CsvGenerator()

# adds a column filled with integers, starting at 100, incrementing
generator.add_column(IntColumn("Integers", start=100))  

# adds a column filled with strings, currently first names from the firstNames.txt dictionary
generator.add_column(StringColumn("Names"))

# add a column filled with random float values between 10 and 20 rounded to 2 digits.
generator.add_column(RandomNumberColumn("Random", low=10, high=20, digits=2))

# adds a column, values are randomly picked from the provided list
generator.add_column(CategoryColumn("Categories", [1, 2, 3, 4]))

# adds a column with name "Calculated", based on Columns Integers and Class
# the arguments of the given function must match order and type of the values of the columns
generator.calculate_column("Calculated", ["Integers", "Categories"],
                           lambda number, category: f'{number} {category}')

# creates pandas DataFrame with 5 rows
data_frame = generator.generate_data_frame(5) 
# creates CSV file in directory "output"
generator.create_csv(5, "test.csv")

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for randomcsv, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size randomcsv-0.1.3-py3-none-any.whl (13.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size randomcsv-0.1.3.tar.gz (9.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page