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


Download files

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

Source Distribution

randomcsv-0.1.3.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

randomcsv-0.1.3-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file randomcsv-0.1.3.tar.gz.

File metadata

  • Download URL: randomcsv-0.1.3.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5

File hashes

Hashes for randomcsv-0.1.3.tar.gz
Algorithm Hash digest
SHA256 32ed02b5c7d97ec3777005d0d7885e1e4be75ebb9404bf1aaa782be0aeb959cf
MD5 4cceb34d0737305dcf411ed03c7bb62c
BLAKE2b-256 bedb453f3a4773a8b3894e417e23879e251c5092ee389711a9739c91e35ba8e9

See more details on using hashes here.

File details

Details for the file randomcsv-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: randomcsv-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5

File hashes

Hashes for randomcsv-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a9ce63bfcef85a029bb4ac13e7a86c335a4c24db3bfeaf35fbff0b5d5aee7ee0
MD5 d1065e9d0ddcf42e9112d940074ee649
BLAKE2b-256 9f9f52b7e991ee149ad8ff1dcb11140cbfe4e22912be9d96f143cf63ea28797a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page