Skip to content

A collection of python programming cheat sheet and tips

Notifications You must be signed in to change notification settings

rayguang/PythonCheatSheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PythonCheatSheet

A collection of python programming cheat sheet and tips

Python tips

Python anti-pattern: common problems with python coding

Python gotcha: useful advanced Python coding warnings/errors and fix

Python Advanced

Metaclass

ionelmc.ro Blog on Understanding Python Metaclass

Exception Handling

StackOverflow: Manual Throw Exception

Pandas

Show all column names of pandas frame

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

Merge, Join vs Concat

Stackoverflow comparison

Pandas Official Guide

Martin-thoma Blog on merge, join and concat

Convert Timestamp to epoch

df['creation_date'] = pd.to_datetime(df['creation_date']).values.astype(np.int64) // 1e9

Data Structure

Tuple list to Dict

>>> my_list = [('a', 1), ('b', 2)]
>>> dict(my_list)
{'a': 1, 'b': 2}

Multiprocess

Multiproc vs Multi Thread

Parallel CPU Bound Tasks with Multiproc

About

A collection of python programming cheat sheet and tips

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published