You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This seems like a great project, I'm unsure why I'm getting this error.
environment Ubutu Docker image.
Here is my Command
codon run gen_random_data.py
--- Here is the error I receive
gen_random_data.py:1:8-11: error: no module named 'csv'
random.codon:263:13-16: error: name 'INF' is not defined
random.codon:661:24-31: error: name '_bisect' is not defined
Below is the code:
import csv
import os
import random
import string
from datetime import datetime, timedelta
def random_string(length=10):
"""Generate a random string of fixed length."""
return ''.join(random.choice(string.ascii_lowercase) for _ in range(length))
def random_date(start, end):
"""Generate a random datetime between start and end."""
return start + timedelta(
seconds=random.randint(0, int((end - start).total_seconds())),
)
def generate_csv(filename, size_limit=1024**3):
"""Generate a CSV file with a target size limit."""
with open(filename, 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(['id', 'name', 'timestamp', 'value'])
This seems like a great project, I'm unsure why I'm getting this error.
environment Ubutu Docker image.
Here is my Command
codon run gen_random_data.py
--- Here is the error I receive
gen_random_data.py:1:8-11: error: no module named 'csv'
random.codon:263:13-16: error: name 'INF' is not defined
random.codon:661:24-31: error: name '_bisect' is not defined
Below is the code:
import csv
import os
import random
import string
from datetime import datetime, timedelta
def random_string(length=10):
"""Generate a random string of fixed length."""
return ''.join(random.choice(string.ascii_lowercase) for _ in range(length))
def random_date(start, end):
"""Generate a random datetime between
start
andend
."""return start + timedelta(
seconds=random.randint(0, int((end - start).total_seconds())),
)
def generate_csv(filename, size_limit=1024**3):
"""Generate a CSV file with a target size limit."""
with open(filename, 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(['id', 'name', 'timestamp', 'value'])
generate_csv('sample_data_to_transform.csv')
The text was updated successfully, but these errors were encountered: