Introduction to Code Workbook6. Import A New Library

6 - Import a new library

This content is also available at learn.palantir.com ↗ and is presented here for accessibility purposes.

📖 Task Introduction

Global Code can be used to define variables and functions that will be available throughout transforms of language you define in your Workbook.

🔨 Task Instructions

  1. Ensure that you're in the Python tab of your Global Code sidebar. If this tab does not have the following line of code in it, copy and paste it into this section:

    from pyspark.sql import functions as F
    
  2. Add the following code as on a new line of your Python Global Code:

    import matplotlib.pyplot as plt
    
  3. Click Preview on your current transformation, us_freight_flights, to confirm that your code was imported successfully.

  4. If there are no errors when the transformation runs, that means that the library has been found and imported successfully. You can then click the » icon near the top-right corner of the Global Code sidebar to collapse it.