Skip to content

Instantly share code, notes, and snippets.

View chirag64's full-sized avatar

Chirag Bhatia chirag64

View GitHub Profile
window.addEventListener('scroll', (evt) => {
const loadMoreBtn = document.querySelector('.loadMoreBtn');
if ((loadMoreBtn.offsetTop) < (scrollY + 1000)) {
loadMoreBtn.click();
}
});
### Merge two dataframes when both have a common column with common values (e.g. id)
pd.merge(df1, df2, how='inner', on='id')
@chirag64
chirag64 / Pandas CheatSheet.ipynb
Created June 1, 2021 19:40
Based on the amazing Udemy course on Pandas by @paskhaver
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chirag64
chirag64 / scanner.sh
Created April 27, 2021 16:08 — forked from andyrbell/scanner.sh
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@chirag64
chirag64 / pandas_cheat.py
Created December 4, 2020 12:46 — forked from pohzipohzi/pandas_cheat.py
Cheat sheet for the python pandas library
import numpy as np
import pandas as pd
#### creating dataframes, adding and dropping columns
df = pd.DataFrame(np.arange(1,10).reshape(3,3),['A','B','C'],['w','x','y'])
df.columns = ['W','X','Y'] # change column names
df['Z']=df['X']+df['Y'] # new column with values X+Y
df['XX']=df.apply(lambda row: row['X']*2, axis=1) # new column with values twice of column X
df['YY']=1 # new column of ones

Indian phonetic alphabets (for use over audio calls)

  • A for Apple
  • B for Ball
  • C for China
  • D for Delhi
  • E for Elephant
  • F for Father
  • G for Gujarat
  • H for Hyderabad