Spaces:
Runtime error
Runtime error
MilesCranmer
commited on
Commit
•
a27eae6
1
Parent(s):
4207871
Add file to generate example data
Browse files- gen_example_data.py +17 -0
gen_example_data.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
rand_between = lambda a, b, size: np.random.rand(*size) * (b - a) + a
|
5 |
+
|
6 |
+
X = pd.DataFrame(
|
7 |
+
{
|
8 |
+
"T": rand_between(273, 373, (100,)), # Kelvin
|
9 |
+
"P": rand_between(100, 200, (100,)) * 1e3, # Pa
|
10 |
+
"n": rand_between(0, 10, (100,)), # mole
|
11 |
+
}
|
12 |
+
)
|
13 |
+
|
14 |
+
R = 8.3144598 # J/mol/K
|
15 |
+
X["y"] = X["n"] * R * X["T"] / X["P"]
|
16 |
+
|
17 |
+
X.to_csv("data.csv", index=False)
|