Sunday, September 8, 2019

Setting up ElasticSearch on EC2 - with remote connection configuration

Install Java 8 sudo yum install java-1.8.0 Remove sudo yum remove java-1.7.0-openjdk    Get ES wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.rpm Use the root user sudo su Install ES sudo rpm --install elasticsearch-6.2.4.rpm      Run ES on system startup sudo chkconfig --add elasticsearch    Go inside the elasticsearch...

Tuesday, August 6, 2019

Working With Date Time - In Depth

A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects. Example import datetime x = datetime.datetime.today() x #> datetime.datetime(2019, 8, 6, 22, 39, 30, 864393) The output is in the following order: ‘year’, ‘month’, ‘date’,...

Sunday, August 4, 2019

Get list from pandas DataFrame column headers

The groupby function can be used to concatenate data from multiple rows into one field. Create a Dataframe import pandas as pd import numpy as np #Create a Dictionary of series d = {'Name': pd.Series(['Alisa','Bobby','Cathrine','Madonna','Rocky','Sebastian','Jaqluine', 'Rahul','David','Andrew','Ajay','Teresa']), ...

Thursday, August 1, 2019

Concatenating Rows in Python Pandas

The groupby function can be used to concatenate data from multiple rows into one field. Create a Dataframe import pandas as pd import numpy as np #Create a Dictionary of series d = {'Name': pd.Series(['Alisa','Bobby','Cathrine','Madonna','Rocky','Sebastian','Jaqluine', 'Rahul','David','Andrew','Ajay','Teresa']), ...

Monday, July 22, 2019

How to split a list inside a Dataframe cell into rows in Pandas

temp = {'name' : ['Edmond', 'ALex'], 'cat' : [['Horror', 'Vengeance', 'Justice'], ['Romance', 'Sacrifice']]} df = pd.DataFrame(temp) df.cat.apply(pd.Series) df.cat.apply(pd.Series) \ .merge(df, left_index = True, right_index = True) df.cat.apply(pd.Series) \ .merge(df, left_index = True, right_index = True) \ .drop(['cat'], axis = 1) df.cat.apply(pd.Series)...

Amount to Words Convert via PostgreSQL

asd CREATE OR REPLACE FUNCTION dateToWords(the_date TIMESTAMP) RETURNS text AS $$ DECLARE _month INTEGER; _day INTEGER; _year INTEGER; _hour INTEGER; _minute INTEGER; _year_text TEXT; _hour_text TEXT; _day_text TEXT; _minute_text TEXT; _exact_time TEXT; _month_text TEXT; e TEXT; BEGIN _month = EXTRACT(MONTH FROM the_date); _day = EXTRACT(DAY FROM the_date); _year = EXTRACT(YEAR FROM the_date); _hour...