Skip to content

Instantly share code, notes, and snippets.

View pandoraxcc's full-sized avatar

pandoraxcc pandoraxcc

View GitHub Profile
@pandoraxcc
pandoraxcc / python_tuples.py
Created April 29, 2021 04:47 — forked from ShyamaSankar/python_tuples.py
Cheat sheet for Python tuples
#### Tuple creation #####
# Create a tuple, also called tuple packing.
numbers = 1, 2
print(numbers) # Output: (1, 2) <- Note that it is represented with an enclosing paranthesis
# Create tuple with paranthesis.
numbers = (1, 2, 3)
print(numbers) # Output: (1, 2, 3)
# Create an empty tuple.
numbers = ()
print(numbers) # Output: ()
@pandoraxcc
pandoraxcc / pandas_cheat.py
Created April 6, 2021 04:57 — 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
@pandoraxcc
pandoraxcc / linebreak.md
Created March 22, 2021 00:06
Line breaks in markdown
Hello  (<-- two spaces)
World

Hello
World