#! /usr/bin/env python3 # def ford_data ( ): #*****************************************************************************80 # ## ford_data returns a normalized copy of the Ford data. # # Discussion: # # Here, the data is read from a file: # # data = np.loadtxt ( 'ford_data.txt' ) # # It might be more efficient for it to be stored internally as an array: # # data = np.array ( [ # [ 27, 9991 ], # [ 17, 9925 ], # [ 28, 10491 ], # ... ..... # [ 7, 11000 ] ] ) # # Output: # # real x[23], y[23]: the mileage and asking price for used Ford Escorts. # import numpy as np data = np.loadtxt ( 'ford_data.txt' ) x = data[:,0] y = data[:,1] x = ( x - np.min ( x ) ) / ( np.max ( x ) - np.min ( x ) ) y = ( y - np.min ( y ) ) / ( np.max ( y ) - np.min ( y ) ) return x, y