Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas apply function to every row

# Get rid of $ and , in the SAL-RATE, then convert it to a float
def money_to_float(money_str):
    return float(money_str.replace("$","").replace(",",""))

df['SAL-RATE'].apply(money_to_float)
Comment

PREVIOUS NEXT
Code Example
Python :: save plotly figure as png python 
Python :: how to import a python function from another file 
Python :: unique id python 
Python :: sorting numbers in python without sort function 
Python :: np.zeros data type not understood 
Python :: AttributeError: __enter__ python 
Python :: python os open notepad 
Python :: n-largest and n-smallest in list in python 
Python :: python try then change something and try again if fails 
Python :: remove 1st column pandas 
Python :: if else in dictionary comprehension python 
Python :: how to use regex in a list 
Python :: how to use timeit in python 3 
Python :: df count zeros 
Python :: append to pandas dataframe 
Python :: display 2d numpy array as image 
Python :: tkmessagebox not found 
Python :: packing and unpacking in python 
Python :: python path from string 
Python :: pil image resize not working 
Python :: compile python to pyc 
Python :: how to create a virtual environment in python 3 
Python :: how to return total elements in database django 
Python :: image no showing in django 
Python :: filter function in pandas stack overflow 
Python :: choromap = go.Figure(data=[data], layout = layout) 
Python :: width and height of pil image 
Python :: named tuple python iterate 
Python :: django orm count 
Python :: axes color python 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =