pandas function on every row code example
Example 1: 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)
Example 2: python print every row of dataframe
df = pandas.read_csv("data.csv")
pandas.set_option('display.max_rows', df.shape[0]+1)
print(df)