
上QQ阅读APP看书,第一时间看更新
How it works...
This section explains how the dataframe is converted into an array:
- The output of our dataframe can be collected using collect() and viewed as seen in the following screenshot:

- The dataframe is converted into an array and the output of the array from that script can be seen in the following screenshot:

- Any set of height, weight, and gender values can be accessed by referencing the index of the array. The array has a shape of (29,3) with a length of 29 elements, and each element is composed of three items. While the length is 29, the index starts at [0] and ends at [28]. The outputs for the shape of the array as well as the first and last rows of the array can be seen in the following screenshot:

- The first and last values of the array can be compared with the original dataframe to confirm that the values and order have not changed as a result of the conversion.