About 128,000 results
Bokep
- Viewed 20k times11edited Jul 31, 2013 at 12:13
On Pandas, you could use something like this:
import pandas as pdimport numpy as npdata = {'state': ['Ohio', 'Ohio', 'Ohio', 'Nevada', 'Nevada'],'year': [2000, 2001, 2002, 2001, 2002],'pop': [1.5, 1.7, 3.6, 2.4, 2.9]}data = pd.DataFrame(data)def hash_col(df, col, N):cols = [col + "_" + str(i) for i in range(N)]def xform(x): tmp = [0 for i in range(N)]; tmp[hash(x) % N] = 1; return pd.Series(tmp,index=cols)df[cols] = df[col].apply(xform)return df.drop(col,axis=1)print hash_col(data, 'state',4)Content Under CC-BY-SA license Explore further
- Question & Answer
- People also ask
Implementing the hashing trick | Code Ease
Build a Hash Table in Python With TDD – Real Python
category_encoders.hashing — Category Encoders 2.6.3 ... - GitHub
Hashing In Python From Scratch ( Code Included ) - Home
Hashing — Category Encoders 2.6.3 documentation - GitHub
Python hash() method - GeeksforGeeks
Implementing the hashing trick in scikit-learn | Python - DataCamp
tf.keras.preprocessing.text.hashing_trick | TensorFlow v2.16.1
hashlib — Secure hashes and message digests - Python
python - Feature Hashing on multiple categorical …
python 3.x - Hashing_trick in Keras. How it works? - Stack Overflow
- Some results have been removed