This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elasticsearch import Elasticsearch | |
import pprint | |
import time | |
if __name__ == '__main__': | |
ELASTICSEARCH_HOST = "localhost" | |
ELASTICSEARCH_PORT = "9200" | |
index_name = "vector_index" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Get column names after one hot encoding by scikit-learn. | |
""" | |
from sklearn.preprocessing import OneHotEncoder | |
import pandas as pd | |
titanic_url = ('https://raw.githubusercontent.com/amueller/' | |
'scipy-2017-sklearn/091d371/notebooks/datasets/titanic3.csv') | |
data = pd.read_csv(titanic_url).loc[:,["sex", "embarked", "pclass"]].dropna() | |
data.head() |