Skip to content

Instantly share code, notes, and snippets.

View kingfischer16's full-sized avatar

Lee MacKenzie Fischer kingfischer16

  • Denmark
View GitHub Profile
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
@kingfischer16
kingfischer16 / num.py
Last active November 1, 2016 10:00 — forked from nxvipin/num.py
Some numerical methods in python.
"""
Bisection, Secant & Newton Raphson Method.
"""
import math
"""
* Variable Description:
*
* f : Given function
* f_ : Derivative of f