https://github.com/onesuper/pandasticsearchpython
from pandasticsearch import DataFrame username = b'xxxx' password = b'xxxx' df = DataFrame.from_es(url='IP:9200', index='x'x'x'x', username=username, password=password, doc_type='x'x'x'x', compat=5 )
TypeError: a bytes-like object is required, not 'str'
將~/anaconda3/lib/python3.7/site-packages/pandasticsearch/client.py中git
59 if username is not None and password is not None: 60 base64creds = base64.b64encode('%s:%s' % (username,password)) 61 req.add_header("Authorization", "Basic %s" % base64creds)
修改成:github
if username is not None and password is not None: base64creds = bytes.decode(base64.b64encode(b'%s:%s' % (username,password))) req.add_header("Authorization", "Basic %s" % base64creds)
limit()函數查詢前20萬條數據,to_pandas()轉成pandas的dataframe函數
pd_df = df.limit(200000).to_pandas()