Skip to content

Commit a70d15f

Browse files
committed
feat: add python onehot script
1 parent c4488d0 commit a70d15f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

benches/pandas_onehot.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pandas as pd
2+
3+
df = pd.read_csv('data/mushrooms.csv')
4+
5+
6+
def onehot(df):
7+
X = pd.get_dummies(df)
8+
return X
9+
10+
11+
if __name__ == "__main__":
12+
import timeit
13+
14+
iterations = 1000
15+
seconds = timeit.timeit(lambda: onehot(df), number=iterations) / iterations
16+
print(f"{seconds * 1000} ms")

0 commit comments

Comments
 (0)