You are on page 1of 1

Python cheat sheet for DP-100

Python is a programming language often used for machine learning by data scientists. The exercises in the Azure Data Scientist course (DP-100)
use Python to train models. To understand the notebooks included in the exercises, you can use this cheat sheet.

PIP install pandas, numpy, matplotlib Variables and print


Your code can refer to libraries and packages to Three common Python libraries to work with data Variables temporarily store data.
perform specific tasks. are pandas, numpy, and matplotlib. Print text and variables to verify your work.

pip install to install the libraries and packages pandas to ingest and process data. = to create a variable of any type.
on your compute. numpy to work with numerical data as arrays. print() to show a message. You can include a
pip show to verify an installment and its matplotlib to visualize data and plot graphs. variable to verify its contents.
version.
data = pd.read_csv(‘diabetes.csv’) data = pd.read_csv(‘diabetes.csv’)
pip install azureml-sdk Accuracy = np.float(acc) print(data)
pip show azureml-sdk fig = plt.figure()

Parameters Comments
From, import, as Many functions expect input parameters. You can Add comments to code to describe what you are
To use a method in your code, import the method have both required and optional parameters. doing. Comment lines will not be executed.
from a library or package.
() to encapsulate input parameters. Go to the # to comment a line.
from to specify the library. documentation of the library to see which
# Count the rows and log the result
import to specify the class. parameters to include and how.
row_count = (len(data))
as to create an alias that is easier to reference. y_pred = model.predict(X_test)
. to access a method within a class.
from azureml.core import Workspace Learn more on:
import pandas as pd
import numpy as np Azure Machine Learning SDK for Python pandas Write basic Python in Notebooks
import matpotlib.pyplot as plt numpy matplotlib Code control statements in Python

You might also like