Monday, December 16, 2019

Display all dataframe lines in python

Sometimes when you want to see all lines in ipython, either in IDE or in notebook, it wont show you because of in-build options. Here are those options, in case you want to change that :

import pandas as pd
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)

Wednesday, December 4, 2019

Vertica creating a temporary list of numbers

I just wanted to quickly check what is the behavior of NULL in analytics functions like median.
So rather than creating a table, I  wanted to pass a list of numbers and see what happens. This is how I achieved it :

SELECT median(val) over() FROM (
SELECT * from (SELECT 1 as val, 1 as row
UNION SELECT 2, 2
UNION SELECT NULL,3
UNION SELECT NULL,4
UNION SELECT 4,5)temp
)temp2;

Tuesday, December 3, 2019

Show all columns in ipython

In few scenarios, when you are in ipython or notebook, you want to see all the columns and not truncated list. For that, we need to execute these commands :

pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)