Читать книгу SAS Viya - Kevin D. Smith - Страница 13

Data Visualization

Оглавление

Since the tables that come back from the CAS server are subclasses of Pandas DataFrames, you can do anything to them that works on DataFrames. You can plot the results of your actions using the plot method or use them as input to more advanced packages such as Matplotlib and Bokeh, which are covered in more detail in a later section.

The following example uses the plot method to download the entire data set and plot it using the default options.

In [21]: iris.plot()

Out[21]: <matplotlib.axes.AxesSubplot at 0x5339050>

If the plot doesn’t show up automatically, you might have to tell Matplotlib to display it.

In [22]: import matplotlib.pyplot as plt

In [23]: plt.show()

The output that is created by the plot method follows.


Even if you loaded the same data set that we have used in this example, your plot might look different since CAS stores data in a distributed manner. Because of this, the ordering of data from the server is not deterministic unless you sort it when it is fetched. If you run the following commands, you plot the data sorted by SepalLength and SepalWidth.

In [24]: iris.sort_values(['SepalLength', 'SepalWidth']).plot()


SAS Viya

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