Skip to content

Instantly share code, notes, and snippets.

@ryantuck
Created January 27, 2016 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryantuck/66e65323103f91b5ac80 to your computer and use it in GitHub Desktop.
Save ryantuck/66e65323103f91b5ac80 to your computer and use it in GitHub Desktop.
import pandas as pd
data = [
[1,2],
[3,4],
[4,5],
[8,9]
]
df = pd.DataFrame(data, columns=['a','b'])
print df
def my_fn(x):
return 2*x
print '-------'
df['b'] = df['b'].apply(my_fn)
print df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment