#print food_info["Iron_(mg)"]#div_1000 = food_info["Iron_(mg)"] / 1000#print div_1000# Adds 100 to each value in the column and returns a Series object.#add_100 = food_info["Iron_(mg)"] + 100# Subtracts 100 from each value in the column and returns a Series object.#sub_100 = food_info["Iron_(mg)"] - 100# Multiplies each value in the column by 2 and returns a Series object.#mult_2 = food_info["Iron_(mg)"]*2
#It applies the arithmetic operator to the first valuein both columns, the second valuein both columns, and so on
water_energy = food_info["Water_(g)"] * food_info["Energ_Kcal"]
water_energy = food_info["Water_(g)"] * food_info["Energ_Kcal"]
iron_grams = food_info["Iron_(mg)"] / 1000
food_info["Iron_(g)"] = iron_grams
# the "Vit_A_IU" column ranges from 0to100000, while the "Fiber_TD_(g)" column ranges from 0to79
#For certain calculations, columns like "Vit_A_IU" can have a greater effect on the result,
#due to the scale of the values
# The largest valuein the "Energ_Kcal" column.
max_calories = food_info["Energ_Kcal"].max()
# Divide the values in"Energ_Kcal" by the largest value.
normalized_calories = food_info["Energ_Kcal"] / max_calories
normalized_protein = food_info["Protein_(g)"] / food_info["Protein_(g)"].max()
normalized_fat = food_info["Lipid_Tot_(g)"] / food_info["Lipid_Tot_(g)"].max()
food_info["Normalized_Protein"] = normalized_protein
food_info["Normalized_Fat"] = normalized_fat
#By default, pandas will sort the data by the column we specify in ascending order and return a new DataFrame
# Sorts the DataFrame in-place, rather than returning a new DataFrame.
#print food_info["Sodium_(mg)"]
food_info.sort_values("Sodium_(mg)", inplace=True)
print food_info["Sodium_(mg)"]
#Sorts by descending order, rather than ascending.
food_info.sort_values("Sodium_(mg)", inplace=True, ascending=False)
print food_info["Sodium_(mg)"]