- Read in the Texas cities dataset, and identify the variables:
>>> cities = pd.read_csv('data/texas_cities.csv')>>> cities
- The City column looks good and contains exactly one value. The Geolocation column, on the other hand, contains four variables: latitude, latitude direction, longitude, and longitude direction. Let's split the Geolocation column into four separate columns:
>>> geolocations = cities.Geolocation.str.split(pat='. ', expand=True)>>> geolocations.columns = ['latitude', 'latitude direction', 'longitude', 'longitude direction']>>> geolocations
- Because the original data type for the Geolocation was an object, ...