How do you do add all matching cell values to a list with Pandas?
Excel File Example, Search for Color[Red], append Fruit into fruit_names = {}
Fruit_ID Color Weight Fruit
1 Red 5lbs Apple
2 Orange 2lbs Orange
3 Red 3lbs Strawberry
import pandas as pd
import os
os.chdir("/users/user/folder/helloworld")
name_list = ["Sheet1"]
fruit_names = {}
def fruit_colors(file):
data = pd.read_excel(file, sheet_name = name_list[0])
for row in data:
print(format(row[0].value, row[1].value).append(fruit_names))
print(fruit_names)