Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

gen_data.py 291 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
  1. import numpy as np
  2. import pandas as pd
  3. X = np.random.randn(1000,4)
  4. noise = np.random.randn(1000)/20
  5. y = np.sum(X, axis=1) + noise
  6. df = pd.DataFrame(X, columns=['x1', 'x2', 'x3', 'x4'])
  7. df['target'] = y
  8. for col in df.columns:
  9. df[col] = "'"+df[col].astype(str)+"'"
  10. df.to_csv('data.csv')
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...