为什么我由于已定义数据文件而收到此错误

时间:2019-06-13 04:08:21

标签: python-3.x

def print_first_point(filename):
    city = filename.split('-')[0].split('/')[-1]
    print('\nCity: {}'.format(city))
    with open(filename, 'r') as f_in:
        trip_reader = csv.DictReader(f_in)
        first_trip = trip_reader.__next__()
        pprint(first_trip)
        return (city, first_trip)
    data_files = pd.read_csv(r'C:\Users\admin\Desktop\NYC-CitiBike-2016.csv',
              r'C:\Users\admin\Desktop\teclov\assignment\New folder\Chicago-Divvy-2016.csv',
              r'C:\Users\admin\Desktop\teclov\assignment\New folder\Washington-CapitalBikeshare-2016.csv',)
    example_trips = {}
for data_file in data_files:
    city, first_trip = print_first_point(data_file)
    example_trips[city] = first_trip

错误:未定义名称“ data_files”

0 个答案:

没有答案