In chapter 10, we reviewed various ways that DataFrame objects can be constructed from different data sources. In this chapter, we discuss the reverse process and show how you can create other objects from a data frame (recall from chapter 9 that a data frame can be a DataFrame or its view, that is, a SubDataFrame). You might want to perform such an operation in two scenarios.
In the first scenario, you need to perform analytical tasks provided by functions that do not accept a data frame as input, but instead accept another type, so you’d need to convert a data frame to the expected target format. An example is conversion of a data frame to a matrix that you want to use later in linear algebra operations.