Skip to Content
Numerical Computing with Python
book

Numerical Computing with Python

by Pratap Dangeti, Allen Yu, Claire Chung, Aldrin Yim
December 2018
Beginner to intermediate
682 pages
18h 1m
English
Packt Publishing
Content preview from Numerical Computing with Python

How to do it...

  1. Read in the Texas cities dataset, and identify the variables:
>>> cities = pd.read_csv('data/texas_cities.csv')>>> cities
  1. 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
  1. Because the original data type for the Geolocation was an object, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Numerical Computing with NumPy

Mastering Numerical Computing with NumPy

Umit Mert Cakmak, Tiago Antao, Mert Cuhadaroglu

Publisher Resources

ISBN: 9781789953633OtherOtherErrata Page