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
%%bash | |
cat > out.csv << EOL | |
lines | |
EOL |
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
def clean_data(data): | |
""" | |
Clean the pandas dataframe. | |
data: pandas dataframe | |
return: cleaned dataframe | |
1. Make column names lowercase and underscored. |
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
ax = users['gender'].value_counts().plot(kind='bar') | |
for p in ax.patches: | |
ax.annotate(np.round(p.get_height(), decimals=2), | |
(p.get_x()+p.get_width()/2., | |
p.get_height()), ha='center', | |
va='center', xytext=(0, 10), | |
textcoords='offset points') |
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
ax = users['gender'].value_counts().plot(kind='barh') | |
for p in ax.patches: | |
ax.annotate(str(int(p.get_width())), (p.get_x() + p.get_width(), p.get_y()), xytext=(-2, 4), textcoords='offset points', horizontalalignment='right') |
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
#!python | |
# -*- coding: utf-8 -*-# | |
""" | |
Create fitsfile. | |
Author : Bhishan Poudel | |
Date : Sep 4, 2018 | |
Combine two fitsfile keeping their fitsheaders. |
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
let scrollstep = 120 | |
" Settings | |
let blacklists = [ "*://localhost.com*/*", "*://localhost:*", "*://codepen.io/*", "*://draw.io/*", "*://*slack.com/*", "*://codesandbox.io/*", "*://codewars.com/*", "*://discordapp.com/*", "://gitter.im/*"] |
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
" Settings | |
map "b" scrollToBottom | |
map "," previousTab | |
map "." nextTab | |
let blacklists = [ "https://*.overleaf.com/*", "*://localhost:*", "*://codepen.io/*", "*://draw.io/*", "*://*slack.com/*", "*://codesandbox.io/*", "*://codewars.com/*", "*://discordapp.com/*", "://gitter.im/*"] |
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
// Bookmark any webpage and change content with this javascript | |
javascript:top.location=%22http://htmlpreview.github.com/?%22+document.URL |
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
def interactive_histogram(df,col,n_bins,bin_range,title,x_axis_label,x_tooltip): | |
"""Plot interactive histogram using bokeh. | |
df: pandas dataframe | |
col: column of panda dataframe to plot (eg. age of users) | |
n_bins: number of bins, e.g. 9 | |
bin_range: list with min and max value. e.g. [10,100] age of users. | |
title: title of plot. e.g. 'Airnb Users Age Distribution' | |
x_axis_label: x axis label. e.g. 'Age (years)'. | |
x_tooltip: x axis tooltip string. e.g. 'Age' |