Apr-27-2018, 01:00 PM
I wrote this code for some uni work, was all working fine then when i logged in this morning to try it again i get "DF is not defined" Can anyone see why at all?
import pandas as pd import csv as df df = pd.read_csv("/Users/maddieroberts/Desktop/code/university_picker/course_data.csv") def read_data_base(filename): """ A function to read data """ return pd.read_csv("/Users/maddieroberts/Desktop/code/university_picker/course_data.csv") def build_boolean_index(df, criteria): """ A function used to input an individuals preferences for university """ indices = [df[key] == value for key, value in criteria.items()] index = indices[0] for column in indices[1:]: index = index & column return index def get_choice(df, criteria): """ A function to return the options calculated from the previous boolean """ index = build_boolean_index(df, criteria) return df[index]