21 lines
841 B
Python
21 lines
841 B
Python
import pandas as pd
|
|
import numpy as np
|
|
from pathlib import Path
|
|
|
|
# columns to fake
|
|
to_fake = ['Culmen Length (mm)', 'Culmen Depth (mm)', 'Flipper Length (mm)', 'Body Mass (g)', 'Delta 15 N (o/oo)', 'Delta 13 C (o/oo)']
|
|
# find all csv files
|
|
files = sorted(list(Path('.').glob('*/*table*.csv')))
|
|
|
|
# first, combine the data. This is done to create mock data in the range of all
|
|
# datasets, not only in the range of single penguin species.
|
|
dfs = []
|
|
for file in files:
|
|
df = pd.read_csv(file)
|
|
dfs.append(df)
|
|
combined_data = pd.concat(dfs, ignore_index=True)
|
|
# create fake data and replace original data with it. Overwrite original file
|
|
for i in range(len(files)):
|
|
for col in to_fake:
|
|
dfs[i][col] = np.random.uniform(combined_data[col].min(), combined_data[col].max(), size=dfs[i][col].size)
|
|
dfs[i].to_csv(files[i])
|