Book Image

Data Science with SQL Server Quick Start Guide

By : Dejan Sarka
Book Image

Data Science with SQL Server Quick Start Guide

By: Dejan Sarka

Overview of this book

SQL Server only started to fully support data science with its two most recent editions. If you are a professional from both worlds, SQL Server and data science, and interested in using SQL Server and Machine Learning (ML) Services for your projects, then this is the ideal book for you. This book is the ideal introduction to data science with Microsoft SQL Server and In-Database ML Services. It covers all stages of a data science project, from businessand data understanding,through data overview, data preparation, modeling and using algorithms, model evaluation, and deployment. You will learn to use the engines and languages that come with SQL Server, including ML Services with R and Python languages and Transact-SQL. You will also learn how to choose which algorithm to use for which task, and learn the working of each algorithm.
Table of Contents (15 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Writing your first python code


Let me start with commenting your code. Use the hash mark for a comment the same way you use it in R. In Visual Studio, you use the Ctrl and Enter keys to execute a line of code where the cursor is, or to execute a marked block of code. I will start with the print() command to print some strings. Both single and double apostrophes are string delimiters. Here is the first Python code:

# This is a comment
print("Hello World!")
# This line is ignored - it is a comment again
print('Another string.')
print('O"Brien') # In-line comment
print("O'Brien")

When you execute the code, the Python Interactive window opens (if it is not open yet), located by default below the Script window, at the bottom of the screen. This is again very similar to R, to the R console window.

You can combine multiple strings and expressions in a single print() statement. For expressions, Python supports all regular mathematical and comparison operators, and executes them in accordance with rules...