Generate realistic raw datasets with optional DQ issues
Project description
Generate realistic raw datasets with optional DQ issues
To install run
pip install rawdata
Basic Usage
Create a random table
import rawdata.generate
colLabel = ['Year', 'Name', 'Born']
colTypes = ['DATE', 'PEOPLE', 'PLACE']
tbl = rawdata.generate.TableGenerator(3, colTypes, colLabel)
print(tbl)
> Year, name, Born
> 2013, Douglas, Scandinavia
> 1999, Hunter, Sierra Leone
> 2005, Shubha, Madagascar
Adding Errors to a table
import rawdata.errors
t = rawdata.errors.TableWithErrors(tbl, 'BAD_STRING')
t.add_errors(2)
print(t.tbl)
And after adding 2 random errors there are additional spaces in Douglas, and the Born column is missing for Hunter
Year Name Born
----- --------- ----------
2013 Douglas Scandinavia
1999 Hunter
2005 Shubha Madagascar
You can use columns generated via a custom list
custom_list = ['Carved Statue', '1984 Volvo', '2 metre Ball of string']
tbl = TableGenerator(5, ['PEOPLE', 'INT', custom_list], ['Name', 'Age', 'Fav Possession'])
print(tbl)
> Name, Age, Fav Possession
> Inez, 58, Carved Statue
> Zane, 50, 2 metre Ball of string
> Jered, 49, 1984 Volvo
> Tameron, 55, 2 metre Ball of string
> Wyatt, 68, Carved Statue
Other functions
import rawdata.generate
n = rawdata.generate.NumberGenerator
s = rawdata.generate.StringGenerator
print('Random Number = ', n.random_int(1,100))
> Random Number = 84
print('Random Letters = ', s.random_letters(40))
> Random Letters = T1CElkRAGPAmWSavbDItDbFmQIvUh26SyJE58x49
print('Random Password = ', s.generate_password())
> Random Password = peujlsmbf19966YKCX
words = rawdata.generate.get_list_words()
print(len(words), ' words : ', words[500:502])
> 10739 words : ['architeuthis', 'arcsine']
places = rawdata.generate.get_list_places()
print(len(places), ' places : ', places[58:60])
> 262 places : ['Brazil', 'British Virgin Islands']
More information is at https://github.com/acutesoftware/rawdata
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rawdata-0.0.9.zip
(812.4 kB
view hashes)