Created
November 14, 2024 19:14
-
-
Save davidrajm/c9a581d6fc673d46b82fbaef8ff58d25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import random | |
# Define departments and projects | |
departments = ['HR', 'Engineering', 'Sales', 'Finance', 'Marketing', 'IT'] | |
projects = [f'Project {chr(65 + i)}' for i in range(20)] # Creates projects A to T | |
# Generate random department-project associations | |
data = [] | |
for project in projects: | |
participating_departments = random.sample(departments, random.randint(2, 4)) | |
for dept in participating_departments: | |
data.append({'Department': dept, 'Project': project}) | |
# Save the dataset to a CSV file | |
df = pd.DataFrame(data) | |
df.to_csv('department_project.csv', index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment