pandas
Detecting keywords in strings:
weather_description.str.contains('Snow')
Detecting nan values stored as strings:
nan
na_values = ['NO CLUE', 'N/A', '0'] requests = pd.read_csv(..., na_values=na_values, ...)
Altering DataFrame values in-place:
DataFrame
zero_zips = requests['Incident Zip'] == '00000' requests.loc[zero_zips, 'Incident Zip'] = np.nan
Fitting a model to data
regr.fit(diabetes_X_train, diabetes_y_train)
Making predictions with a model
regr.predict(diabetes_X_test)
Model evaluation
mean_squared_error(diabetes_y_test, diabetes_y_pred)