Data Science Lab
  • What is Data Science Lab?
  • Accessing the Data Science Lab Module
  • Data Science Lab Quick Start Flow
  • Project
    • Environments
    • Creating a Project
    • Project List
      • View
      • Keep Multiple Versions of a Project
      • Sharing a Project
      • Editing a Project
      • Activating a Project
      • Deactivating a Project
      • Deleting a Project
    • Tabs for a Data Science Lab Project
      • Tabs for TensorFlow and PyTorch Environment
        • Notebook
          • Ways to Access Notebook
            • Create
            • Import
              • Importing a Notebook
              • Pull from Git
          • Notebook Page
            • Preview Notebook
            • Notebook Cells
              • Using a Code Cell
              • Using a Markdown Cell
              • Using an Assist Cell
            • Renaming a Notebook
            • Resource Utilization Graph
            • Notebook Taskbar
            • Notebook Operations
              • Datasets
                • Copy Path (for Sandbox files)
              • Secrets
              • Algorithms
              • Transforms
              • Utility Notebook Operation
              • Models
                • Model Explainer
                • Registering & Unregistering a Model
                • Model Filter
              • Artifacts
              • Files
              • Variable Explorer
              • Writers
              • Find and Replace
            • Notebook Actions
          • Notebook List
            • Notebook List Actions
              • Export
                • Export to Pipeline
                • Export to GIT
              • Register as Job
              • Notebook Version Control
              • Sharing a Notebook
              • Deleting a Notebook
        • Dataset
          • Adding Data Sets
            • Data Sets
            • Data Sandbox
          • Dataset List Page
            • Preview
            • Data Profile
            • Create Experiment
            • Data Preparation
            • Delete
        • Utility
          • Pull from Git (Utility)
        • Model
          • Model Explainer
          • Share a Model
          • Import Model
          • Export to GIT
          • Register a Model
          • Unregister A Model
          • Register a Model as an API Service
            • Register a Model as an API
            • Register an API Client
            • Pass Model Values in Postman
          • AutoML Models
        • Auto ML
          • Creating AutoML Experiments
            • Creating an Experiment
          • AutoML List Page
            • View Report
              • Details
              • Models
                • View Explanation
                  • Model Summary
                  • Model Interpretation
                    • Classification Model Explainer
                    • Regression Model Explainer
                    • Forecasting Model Explainer
                  • Dataset Explainer
            • Delete
      • Tabs for PySpark Environment
        • Notebook
          • Ways to Access Notebook
            • Create
            • Import
              • Importing a Notebook
          • Notebook Page
            • Preview Notebook
            • Notebook Cells
              • Using a Code Cell
              • Using a Markdown Cell
              • Using an Assist Cell
            • Renaming a Notebook
            • Resource Utilization Graph
            • Notebook Taskbar
            • Notebook Operations
              • Datasets
                • Copy Path (for Sandbox files)
              • Secrets
              • Utility
              • Files
              • Variable Explorer
              • Writers
              • Find and Replace
            • Notebook Actions
          • Notebook List
            • Notebook List Actions
              • Export
                • Export to Pipeline
                • Export to GIT
              • Register as Job
              • Notebook Version Control
              • Sharing a Notebook
              • Deleting a Notebook
        • Dataset
          • Adding Data Sets
            • Data Sets
            • Data Sandbox
          • Dataset List Page
            • Preview
            • Data Profile
            • Data Preparation
            • Delete
        • Utility
  • Repo Sync Project
    • Environments
    • Creating a Repo Sync Project
    • Project List
      • View
      • Project Migration
      • Keep Multiple Versions of a Project
      • Sharing a Project
      • Editing a Project
      • Activating a Project
      • Deactivating a Project
      • Deleting a Project
    • Tabs for a Data Science Lab Project
      • Tabs for TensorFlow and PyTorch Environment
        • Notebook
          • Accessing the Notebook Tab
          • Adding a Folder or File
          • Notebook Page
            • Preview File
            • .ipynb Cells
              • Using a Code Cell
              • Using a Markdown Cell
              • Using an Assist Cell
            • Resource Utilization Graph
            • Notebook Taskbar
            • Operations for an .ipynb File
              • Datasets
                • Copy Path (for Sandbox files)
              • Secrets
              • Algorithms
              • Transforms
              • Models
                • Model Explainer
                • Registering & Unregistering a Model
                • Model Filter
              • Files
              • Variable Explorer
              • Writers
              • Find and Replace
            • Actions Icons for .ipynb File
          • File Options
            • Export
            • Register
            • Delete
          • Git Console
        • Dataset
          • Adding Data Sets
            • Data Sets
            • Data Sandbox
          • Dataset List Page
            • Preview
            • Data Profile
            • Create Experiment
            • Data Preparation
            • Delete
        • Model
          • Import Model
          • Model Explainer
          • Share a Model
          • Export to GIT
          • Register a Model
          • Unregister A Model
          • Register a Model as an API Service
            • Register a Model as an API
            • Register an API Client
            • Pass Model Values in Postman
          • AutoML Models
        • Auto ML
          • Creating AutoML Experiments
            • Creating an Experiment
          • AutoML List Page
            • Experiment Status
            • Actions
              • View Report
                • Details
                • Models
                  • View Explanation
                    • Model Summary
                    • Model Interpretation
                      • Classification Model Explainer
                      • Regression Model Explainer
                      • Forecasting Model Explainer
                    • Dataset Explainer
              • Delete
      • Tabs for PySpark Environment
        • Notebook
          • Accessing the Notebook Tab
          • Adding a Folder or File
          • Notebook Page
            • Preview a File
            • Cells for .ipynb Files
              • Using a Code Cell
              • Using a Markdown Cell
              • Using an Assist Cell
            • Resource Utilization Graph
            • Notebook Taskbar
            • Operations for an .ipynb File
              • Datasets
                • Copy Path (for Sandbox files)
              • Secrets
              • Files
              • Variable Explorer
              • Writers
              • Find and Replace
            • Actions for .ipynb Files
            • File Options
              • Export
              • Register
              • Delete
            • Git Console
        • Dataset
          • Adding Data Sets
            • Data Sets
            • Data Sandbox
          • Dataset List Page
            • Preview
            • Data Profile
            • Data Preparation
            • Delete
Powered by GitBook
On this page
  • Importing a Utility Script
  • Importing the Utility Script inside a Notebook
  • Updating the Utility Script
  • Sample Utility Script
  1. Project
  2. Tabs for a Data Science Lab Project
  3. Tabs for TensorFlow and PyTorch Environment

Utility

This tab allows to create and list the python scripts (.py files) that can be imported to your notebook.

PreviousDeleteNextPull from Git (Utility)

Last updated 1 year ago

Check out this walk-through on how to import a Utility scrip file to the DS Lab Project.

Importing a Utility Script

  • Navigate to the Utility tab for a Project.

  • Click the Add Script option.

  • The Add utility script page opens.

  • Select the Import Utility option.

  • Provide a Name for the Utility script.

  • Provide description for the Utility script.

  • Use the Choose File option to import a Utility file from the system.

  • After the file gets imported from the system, the file name appears next to the Choose File option.

  • The Save option will be enabled, click the Save option.

  • A notification message appears.

  • The imported script gets added under the Utility tab.

Importing the Utility Script inside a Notebook

  • Copy a utility script name using the Utility list.

  • Navigate to the Notebook tab.

  • Upload a Notebook or create a new Notebook and Navigate to the Notebook page.

  • Add a Code cell.

  • Write code to import data with specific class.

  • Provide the Utility script as the resource to get data.

  • Specify the variables to get the class and get the data in the next code cell.

  • Provide print function to see the data.

  • Run all the cells.

  • You can get the output below.​

Updating the Utility Script

  • Navigate to the Utility tab.

  • Select an uploaded utility script from the list.

  • Click the Edit icon.

  • The Update Utility Script page opens displaying the utility script content.

  • Click the Validate option.

  • The Logs will be displayed in the Logs space.

  • Click the Update option.

  • A success message appears.

  • The selected Utility script gets updated.

Please Note:

  • The name of the selected utility script cannot be changed by using the update option.

Sample Utility Script

Please use the below-given sample Utility script to explore and use the Utility option provided in the Data Science Lab.

# importing employee.py as a module in DS Lab Notebook.

import employee
import time
import logging
import pandas as pd
from pymongo import MongoClient

def run_scripts(conn_str, database, collection):
    conn_str = conn_str
    database = database
    collection = collection
    client = MongoClient(conn_str)
    db = client[database]
    collection = db[collection]
    res = employee.emp_data()
    
    for i in res:
        salary = i.get('salary', 0)
        i['status'] = 'rich' if salary > 50000 else ('middle_class' if 25000 < salary < 50000 else 'poor')
        logging.info(i)
        print(i)
    collection.insert_many(res)
    print(f"Inserted {len(res)} rows into MongoDB")
    logging.info(f"Inserted {len(res)} rows into MongoDB")
    
#The variable 'res' in this script holds the results derived from the code written in the utility file.

Refer the page to get an overview of the Data Science Lab module in nutshell.

The user can also import a Utility file by using the Utility option provided inside a Notebook. Refer the page to understand it in details.

Data Science Lab Quick Start Flow
Utility Notebook Operation
Importing a Utility Script file
the Utility Script get updated.