Читать книгу Algorithms For Dummies - John Paul Mueller, John Mueller Paul, Luca Massaron - Страница 81

Performing Essential Data Manipulations Using Python

Оглавление

IN THIS CHAPTER

Using matrixes and vectors to perform calculations

Obtaining the correct combinations

Employing recursive techniques to obtain specific results

Considering ways to speed calculations

You’ve probably used online tutorials or other methods to learn the basics of the Python language — the arcane symbols you use to communicate with your computer. (If not, you can find good basic tutorials at https://www.w3schools.com/python/ and https://www.tutorialspoint.com/python/index.htm). However, simply knowing how to control a language by using its constructs to perform tasks isn’t enough to create a useful application. The goal of mathematical algorithms is to turn one kind of data into another kind of data. Manipulating data means taking raw input and doing something with it to achieve a desired result. (This is a topic covered in Python for Data Science For Dummies, by John Paul Mueller and Luca Massaron [Wiley].) For example, until you do something with traffic data, you can’t see the patterns that emerge that tell you where to spend additional money in improvements. The traffic data in its raw form does nothing to inform you — you must manipulate it to see the pattern in a useful manner.

In times past, people performed the various manipulations to make data useful by hand, which required advanced math knowledge. Fortunately, you can find Python packages to perform most of these manipulations using a little code. You don’t have to memorize arcane manipulations anymore — just know which Python features to use. That’s what this chapter helps you achieve. You discover the means to perform various kinds of data manipulations using easily accessed Python packages designed especially for the purpose. (Chapter 5 takes the next step and shows you how to create your own library of hand-coded algorithms.) This chapter begins with vector and matrix manipulations. Later sections discuss techniques such as recursion that can make the tasks even simpler, plus perform some tasks that are nearly impossible using other means. You also discover how to speed up the calculations so that you spend less time manipulating the data and more time doing something really interesting with it.

You don’t have to type the source code for this chapter manually. In fact, using the downloadable source is a lot easier. You can find the source for this chapter in the \A4D2E\A4D2E; 04; Basic Vectors and Matrixes.ipynb, \A4D2E\A4D2E; 04; Binary Search.ipynb, and \A4D2E\A4D2E; 04; Recursion.ipynb files of the downloadable source. See the Introduction for details on how to find these source files.

Algorithms For Dummies

Подняться наверх