Play with Python: An intro to Data Science

Similar documents
Topic 7: Lists, Dictionaries and Strings

Python review. 1 Python basics. References. CS 234 Naomi Nishimura

egrapher Language Reference Manual

ENGR 101 Engineering Design Workshop

GE PROBLEM SOVING AND PYTHON PROGRAMMING. Question Bank UNIT 1 - ALGORITHMIC PROBLEM SOLVING

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes

CMSC 201 Computer Science I for Majors

Variable and Data Type I

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

CSCE 110 Programming I Basics of Python: Variables, Expressions, Input/Output

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

Variable and Data Type I

Beyond Blocks: Python Session #1

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Key Differences Between Python and Java

Introduction to Python! Lecture 2

Intro. Scheme Basics. scm> 5 5. scm>

The Big Python Guide

Programming to Python

Student Number: Comments are not required except where indicated, although they may help us mark your answers.

Script language: Python Data structures

And Parallelism. Parallelism in Prolog. OR Parallelism

CHAPTER 2: Introduction to Python COMPUTER PROGRAMMING SKILLS

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D

Basic Concepts. Computer Science. Programming history Algorithms Pseudo code. Computer - Science Andrew Case 2

Text Input and Conditionals

Topic 2: Introduction to Programming

Exam 1 Format, Concepts, What you should be able to do, and Sample Problems

CSCE 110 Programming I

Jython. secondary. memory

Introduction to Bioinformatics

Python: common syntax

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D

Programming for Engineers in Python

1/11/2010 Topic 2: Introduction to Programming 1 1

Introduction to Python

Computer Sciences 368 Scripting for CHTC Day 3: Collections Suggested reading: Learning Python

Data Structures. Lists, Tuples, Sets, Dictionaries

Introduction to Python: Data types. HORT Lecture 8 Instructor: Kranthi Varala

S206E Lecture 19, 5/24/2016, Python an overview

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017

CS Summer 2013

There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals:

Webinar Series. Introduction To Python For Data Analysis March 19, With Interactive Brokers

Overview of List Syntax

Babu Madhav Institute of Information Technology, UTU 2015

Programming with Python

For strings (and tuples, when we get to them), its easiest to think of them like primitives directly stored in the variable table.

CIS192: Python Programming

Python I. Some material adapted from Upenn cmpe391 slides and other sources

ECE 364 Software Engineering Tools Lab. Lecture 3 Python: Introduction

Introduction to Data Science. Introduction to Data Science with Python. Python Basics: Basic Syntax, Data Structures. Python Concepts (Core)

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

PYTHON- AN INNOVATION

Senthil Kumaran S

Pace University. Fundamental Concepts of CS121 1

Computer Components. Software{ User Programs. Operating System. Hardware

SOFT 161. Class Meeting 1.6

The current topic: Python. Announcements. Python. Python

Python Unit

Collections. Lists, Tuples, Sets, Dictionaries

Lecture 27. Lecture 27: Regular Expressions and Python Identifiers

Scripting Languages. Python basics

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

About the Final. Saturday, 7-10pm in Science Center 101. Closed book, closed notes. Not on the final: graphics, file I/O, vim, unix

CS1 Lecture 11 Feb. 9, 2018

CS S-02 Python 1. Most python references use examples involving spam, parrots (deceased), silly walks, and the like

Abstract Data Types. CS 234, Fall Types, Data Types Abstraction Abstract Data Types Preconditions, Postconditions ADT Examples

COLLEGE OF ENGINEERING, NASHIK-4

1. BASICS OF PYTHON. JHU Physics & Astronomy Python Workshop Lecturer: Mubdi Rahman

Algorithms and Programming I. Lecture#12 Spring 2015

Data Analyst Nanodegree Syllabus

Expressions. Eric Roberts Handout #3 CSCI 121 January 30, 2019 Expressions. Grace Murray Hopper. Arithmetic Expressions.

Program Planning, Data Comparisons, Strings

Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts

M/s. Managing distributed workloads. Language Reference Manual. Miranda Li (mjl2206) Benjamin Hanser (bwh2124) Mengdi Lin (ml3567)

Fall 2017 CISC124 9/16/2017

Flow Control: Branches and loops

Python. Jae-Gil Lee Based on the slides by K. Naik, M. Raju, and S. Bhatkar. December 28, Outline

Java Identifiers, Data Types & Variables

Hello, World! An Easy Intro to Python & Programming. Jack Rosenthal

Introduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15

Programming in Python

Table of Contents EVALUATION COPY

Getting Started Values, Expressions, and Statements CS GMU

Python: Short Overview and Recap

CS 61C: Great Ideas in Computer Architecture Introduction to C

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:

Session 1: Introduction to Python from the Matlab perspective. October 9th, 2017 Sandra Diaz

CS 231 Data Structures and Algorithms, Fall 2016

Data Science. Data Analyst. Data Scientist. Data Architect

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.

Short Introduction to Python Machine Learning Course Laboratory

Programming with Java

The Practice of Computing Using PYTHON

3 The Building Blocks: Data Types, Literals, and Variables

UNIT 5. String Functions and Random Numbers

Math Modeling in Java: An S-I Compartment Model

AI Programming CS S-02 Python

Transcription:

Play with Python: An intro to Data Science Ignacio Larrú Instituto de Empresa

Who am I? Passionate about Technology From Iphone apps to algorithmic programming I love innovative technology Former Entrepreneur: Founded several companies from online memorabilia e-commerce to structural civil engineering calculations. Investment Banker: I advise Spanish companies in M&A and IPO processes Venture Capital & Bootcamp: CFO, investment director at K Fund + Academic Director of IE Data Science Bootcamp 2

Big Data and Data Science Big Data technologies Data Science

Why is Data Science so difficult?

Overview of the Data Science process Validation!!!! Framing the Problem Solving the Problem Action!!!

Problem recognition Business comes first, think on what moves the needle Focus specific on decisions that will be made as a result of the analysis Helps everyone realize the reason for the analysis Makes identifying key stakeholders easier No decision. No analytics? Plan your objective for your problem: Investigation Exploration A/B Testing Survey Prediction Past performance ( reporting) Scope of the problem should be expansive but by the end of the problem framing you should have a clear statement of the problem

Exploratory Data Analysis Use descriptive statistics (median, mode, variance, frequency tables, correlations lines, etc ) to understand the important characteristics of a dataset Identify trends and outliers

Overview of Data processing algorithms (i) 1. Classification -> for each individual in a population, which of a set of clasess this individual belongs to. Among all the customers of ACME, which are likely to respond to a given offer? 2. Regression -> Estimate or predict, for each individual, the numerical value of some variable for that individual How much will a customer use the service?

Overview of Data processing algorithms (ii) 3. Similarity matching -> identify similar indivduals based on data known about them Other customers also bought 4. Clustering -> Group individuals in a population together by their similarity but not driven by nay specific purpose Do our customers form natural groups or segments? 5. Co occurence ->Find associations between entitites based on transactions involving them What items are commonly purchased together?

Can data visualizations hurt your analysis?

Can data visualizations hurt your analysis?

Can data visualizations hurt your analysis?

Can data visualizations hurt your analysis?

Lying with graphs Source: Hbr.com

Lying with graphs Source: Hbr.com

Python Data Science Stack

Hello World! print( hello World ) 17

Python is interpreted 18

Programming Python 19

Comments in Python # for a single line comment for a multiple line comment 20

Variables in Python 21

Variables in Python Don t need to have a pre-defined type, they get the type from the value they are pointing at Four main types: String holds text based values name = Ignacio int Integer numbers name = 10 float floating decimal numbers name = 10.4 Boolean (True or False) More variable types (lists, tuples, dictionaries to be reviewed during the course) 22

Variables in Python A variable has a name (identifier) a type a scope and a value A valid identifier is a non-empty sequence of characters with: The start character can be the underscore "_" or a capital or lower case letter The letters following the start character can be anything which is permitted as a start character plus the digits Identifiers are case-sensitive! Python keywords are not allowed as identifier names! 23

Python vs. other languages Python Statically typed languages Variable type determined at runtime Variable bound to one object and the object has only one type Varible can change type by changing the type of the object bound to the variable Bound to a type at compile type Bound to an object at runtime Need to declare the variable before using it 24

Python is a dynamically typed language 25

Python is a strongly typed language 26

With every great power Guidelines Use descriptive names (x vs. sales_amount) Be consistent (user_name or username?) Follow the traditions of the language Usually in Python variable names start with a lowercase letter and avoid starting with an underscore Keep the length in check no user_total_sales_month_report 27

Mathematical operators Source:http://www.emcu.it/ 28

Mathematical operators 29

Converting values float(x) - returns a floating-point value by converting x int(x) str(x) - returns an integer value by converting x - returns a string value by converting x bool(x) returns a boolean value 30

If else - elif 31

If else - elif 32

Logical operators 33

While Loop 34

While and if 35

For Loops 36

Range() Function range([start], stop[, step]) 37

Break, Continue and pass with else Break -> End loop Continue -> End operation Pass -> Null statement used as placeholder Else at the end of loops: For -> ended normally the loop ( no break) While -> The loop condition is false 38

Break, Continue and pass with else 39

Python simple data structures 40

Sequences 41

Strings are sequences 42

Using len() and in len() function will return the length of a sequence The in operator checks if an element is a member of a sequence If the element is a member the condition is true else it is false 43

Using len() and in 44

Programming exercise 45

Slicing Sequences 46

Programming exercise 47

Lists Mutables sequences 48

Lists Adding new items append adds at the end of the list Insert(index,value) allows you to insert at a given index 49

Lists Remove remove(value) del function 50

Lists Remove items 51

Sort() vs. Sorted() 52

Tuples Inmutable secuences that can contain elements of different types that can be mutable If the contents not need to change used tuples vs. lists Faster than lists 53

Tuples are inmutable but not its elements 54

Sets Non duplicative unordered collections 55

Sets Operations 56

Sets Math Operations 57

Sets Math Operations 58

Dictionaries 59

Dictionaries 60

Dictionaries - operations update(d) to join dictionaries (or {**x,**y}) copy() to creatr a shallow copy get( key ) returns None if element doesn t exist 61

Dictionaries - operations 62

Crossfit coding 63

Session Wrap-up 64