I'll help you create a synthetic dataset. First, let me understand what kind of dataset you need. Here are a few questions to help me generate the most useful data for you:
-
What type of data do you need? (e.g., customer data, sales transactions, sensor readings, employee records, etc.)
-
How many rows/records would you like?
-
What specific columns/features should the dataset include?
-
Are there any specific data distributions or patterns you want to simulate?
For now, let me create a sample synthetic dataset to demonstrate. I'll create a customer transaction dataset with various realistic features:
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
import random
# Set random seed for reproducibility
np.random.seed(42)
random.seed(42)
# Number of records
n_records = 1000
# Generate synthetic data
data = {
'customer_id': [f'CUST_{str(i).zfill(5)}' for i in range(1, n_records + 1)],
'age': np.random.normal(35, 12, n_records).clip(18, 80).astype(int),
'gender': np.random.choice(['M', 'F', 'Other'], n_records, p=[0.48, 0.48, 0.04]),
'location': np.random.choice(['New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix',
'Philadelphia', 'San Antonio', 'San Diego', 'Dallas', 'San Jose'],
n_records),
'account_creation_date': [datetime(2020, 1, 1) + timedelta(days=random.randint(0, 1460))
for _ in range(n_records)],
'purchase_amount': np.random.lognormal(3.5, 1.2, n_records).round(2),
'product_category': np.random.choice(['Electronics', 'Clothing', 'Home & Garden',
'Sports & Outdoors', 'Books', 'Toys & Games'],
n_records),
'payment_method': np.random.choice(['Credit Card', 'Debit Card', 'PayPal', 'Cash'],
n_records, p=[0.45, 0.30, 0.20, 0.05]),
'satisfaction_score': np.random.choice([1, 2, 3, 4, 5], n_records,
p=[0.05, 0.10, 0.20, 0.35, 0.30]),
'is_premium_member': np.random.choice([True, False], n_records, p=[0.3, 0.7])
}
# Create DataFrame
df = pd.DataFrame(data)
# Add some derived features
df['days_since_account_creation'] = (datetime.now() - df['account_creation_date']).dt.days
df['age_group'] = pd.cut(df['age'], bins=[0, 25, 35, 50, 65, 100],
labels=['18-25', '26-35', '36-50', '51-65', '65+'])
# Display first few rows
print("First 10 rows of the synthetic dataset:")
print(df.head(10))
print(f"\nDataset shape: {df.shape}")
print("\nDataset info:")
print(df.info())
print("\nBasic statistics:")
print(df.describe())
# Save to CSV
csv_filename = 'synthetic_customer_data.csv'
df.to_csv(csv_filename, index=False)
print(f"\nDataset saved as '{csv_filename}'")
This code creates a synthetic customer transaction dataset with the following features:
- Customer ID
- Age (normally distributed)
- Gender
- Location (major US cities)
- Account creation date
- Purchase amount (log-normally distributed to simulate real purchase patterns)
- Product category
- Payment method
- Satisfaction score (1-5 scale)
- Premium membership status
- Derived features like days since account creation and age group
The dataset is automatically saved as 'synthetic_customer_data.csv' in your current directory.
Would you like me to:
- Modify this dataset with different features or distributions?
- Create a completely different type of dataset?
- Adjust the number of records?
- Add more complex relationships between variables?
Just let me know your specific requirements and I'll customize the synthetic data generation accordingly!