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)

Thursday, November 7, 2019

i3 layout reload configuration

Recently started playing around with i3. I liked it so far. It can open all the applications where you need after a restart. After learning how to split the screens etc, get to your desired configuration. Once fixed, execute following : 

i3-save-tree > i3.json
We need to edit json file so that "class" entries in "swallows" sections are un-commented.

Enter following in config "~/.config/i3/config" :

exec load_i3_layout.sh
Where as contents of the shell scripts are :

i3-msg 'workspace 1; append_layout i3.json'
i3-msg 'exec /usr/bin/chromium-browser'
i3-msg 'exec /usr/bin/dbeaver'
i3-msg 'exec /snap/bin/pycharm-community'
i3-msg 'exec /usr/bin/nautilus'
i3-msg 'exec /usr/bin/gnome-terminal'
i3-msg 'exec /usr/bin/chromium-browser'
This will open up all the windows at your needed locations.