0% found this document useful (0 votes)
15 views43 pages

Handouts Lecture 1

This document provides an overview and introduction to a course on Business Lab & Professional Skills. It discusses the course objectives, structure, and assessment. The course aims to teach soft skills like questioning, social styles, and negotiation. It also includes a module on Python for accounting and control applications. Python basics like variables, data types, operators and string methods are introduced. Examples of data analytics applications in risk management, market insights, and customer analysis are also provided.

Uploaded by

Shuyi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views43 pages

Handouts Lecture 1

This document provides an overview and introduction to a course on Business Lab & Professional Skills. It discusses the course objectives, structure, and assessment. The course aims to teach soft skills like questioning, social styles, and negotiation. It also includes a module on Python for accounting and control applications. Python basics like variables, data types, operators and string methods are introduced. Examples of data analytics applications in risk management, market insights, and customer analysis are also provided.

Uploaded by

Shuyi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Business Lab & Professional Skills

Lecture 1: Introduction & Python Basics


Dr. J.J.F. van Raak (j.j.f.vanraak@uva.nl)
Today

§ Course information
§ General introduction to programming
• Python basics
• Mathematical operations
• Python variables and data types
Course objectives

On successful completion of this course the students should:


• be able to use practical skills and insights that are relevant for their professional
career;
• demonstrate a high level of professionalism in engaging with companies and fellow
participants;
• demonstrate a high level of communication skills;
• demonstrate effective negotiation skills and should be able to adapt their negotiation strategy
and style to various settings;
• get into touch with the work field and potential employers and develop career
opportunities;
• be familiar with the core concepts of programming in Python;
• be able to identify opportunities to apply insights from data analytics for Business
Intelligence and risk identification purposes;
• be familiar with contemporary developments related to machine learning and
natural language processing and their impact on the accounting profession
Course structure

§ Soft skills
• PwC: Questioning mind
• EY: Social styles
• BDO: Negotiation skills
§ Module: Python for Accountancy & Control
Python for Accountancy & Control

§ Lecture 1: Introduction to programming with Python


• Python, Jupyter, variables, operators and operands, strings and methods
§ Lecture 2: Functions and Data structures
• Iteration and loops, conditionals, lists, tuples, dictionaries, functions, etc.
§ Lecture 3: Probabilities, Stochastic thinking and DataFrames
• Monte Carlo simulation and Pandas DataFrames
§ Lecture 4: Introduction to Machine Learning
• (Logistic) regression, K-Nearest Neighbours, and K-Means clustering
§ Lecture 5: Natural Language Processing & Visualization
• Bag of words, stemming and lemmatization, sentiment analysis
Assessment

§ Individual reflection on workshops (10%)


§ Python assignments (30%)
§ Final exam: Python programming (60%)

Required attendance:
§ At least 2 workshops and 7 out of 9 Python sessions
Importance of Data Analytics & Python for accounting

§ Data is key for business intelligence


• Handle large amounts of data
• Structured, semi-structured and unstructured data
§ Understand basic coding and algorithms
• Integrate into other software such as Excel
§ Automate repetitive tasks
• E.g., data entry, generate reports, data analysis
§ Improve your analytical thinking and problem-solving skills
§ Use machine learning and AI to your advantage
• Predictive models, anomaly detection, and fraud detection
§ Perform in interdisciplinary teams
§ Enhance your skillset
• Python proficiency is increasingly sought after
Examples of applications of data analytics

§ Risk management
• Default prediction, regulatory compliance, credit scoring, fraud prediction
§ Generating market insights
• Competitor analysis, sales forecasting, price optimization
§ Process mining
• Process efficiency, effectiveness, bottlenecks and exceptions
§ Natural language processing
• Sentiment analysis, document classification, labelling, chat bots
§ Customer analysis
• Churn prediction, segmentation, lifetime value analysis
§ Supply chain management
• Manage inventory levels, reduce carrying costs
Data Science Venn Diagram

Source: http://drewconway.com/zia/2013/3/26/the-data-science-venn-diagram
Top programming languages

Source: https://spectrum.ieee.org/the-top-programming-languages-2023
Python
§ Open source
• Free to use
§ Cross-platform
• Available for Windows, Mac and Linux
§ Easy to learn
• Focus on readability of code
• Use of indentation for code blocks
§ General programming language
• Versatile
• Software development, web development, automation, machine learning, etc.
• Interpreted programming language
§ De facto language for data science and machine learning
• Many useful data science libraries
• Numpy, Pandas, Matplotlib, Scikit Learn, etc.
• Large community of users and developers
What is a program?

§ A sequence of instructions which specify how to perform a computation


• Mathematical (solving a system of equations):
• E.g., computing the square root of a number
• Symbolic:
• searching and replacing text in a document
• processing an image
• playing a video
§ Basic instructions:
• Input: data from a keyboard, a file, etc.
• Ouput: display data, save a file, send a document, etc.
• Math: mathematical operations, such as addition or subtraction
• Conditional execution: check for certain conditions and only run the appropriate code
• Repetition: perform actions repeatedly (typically with some variation)
New to programming?

§ Practice!
§ Cannot passively absorb programming as a skill
§ Don’t be afraid to try out Python commands
Expressions and statements

§ Expressions:
• Combination of objects and operators
• <object><operator><object>
• Code constructs that evaluate to a value
• 16 + 12
• n + 10
• a == b
§ Statements: commands executed
• Instructions that perform some sort of action, but do not produce a value
• Determine the flow of a program
• E.g., assignments, control flow statements (if/else), print statements, import
statements, and return statements
Jupyter Notebook

§ Interactive environment
• Code, text, data visualizations and other ouput
§ Bring your own device
• Tutorials
• Workshops
§ Using Jupyter Notebook
• Google Colaboratory
https://colab.research.google.com
• No installation required
• Alternative:
• Local installation of Jupyter using Anaconda
https://www.anaconda.com
• May require administration rights to install
• No support by faculty
Google Colaboratory
Jupyter Notebook
Our first program

print statement
Arithmetic operators
Operator symbol Operator name Description
+ Addition Add two operands
- Subtraction Subtract the right operand from the left operand
* Multiplication Multiply two operands
/ Division Divide the left operand by the right operand, return a float
// Floor division Divide the left operand by the right operand and return the
floor value (integer)
** Exponent Raise the left operand to the power of the right operand
% Modulo Returns the remainder of the division of the left operand by
the right operand
Coding examples
§ Addition:

§ Subtraction:

§ Multiplication:

§ Division:
Coding examples
§ Floor division:

§ Exponent:

§ Modulo:
Assignment statements

An assignment statement creates a new variable and gives it a value:


welcome_msg=“Welcome to the course”
number_students = 130
number_lectures = 5
Variable names

§ Use meaningful variables names


• Enhances readability of code
• roa = p / a vs. roa= profit / total_assets
§ Variables names can consist of letters, numbers and underscores
• Variable names cannot start with a number

• Variables names can have uppercase and lowercase letters


• convention is to use only lowercase letters

• roa and ROA are two distinct variables


§ Think of variables as labels that you assign to values
Variable names

You cannot use keywords as variable names

Keywords are reserved words that have specific meanings and purposes and can't be used
for anything but those specific purposes
§ Examples of keywords: if, elif, else, while, for, return, import
§ Note that class is printed in blue, indicating that it is a keyword
Relational operators
Operator symbol Operator name Description
== equal to Compares if the value op the left operand is equal to the
value op the right operand
!= not equal to Compares if the value op the left operand is not equal to the
value op the right operand
< less than Tests if the value op the left operand is smaller than the
value op the right operand
> greater than Tests if the value op the left operand is greater than the
value op the right operand
<= less than or equal to Tests if the value op the left operand is smaller than or equal
to the value op the right operand
>= greater than Tests if the value op the left operand is greater than or equal
to the value op the right operand
Coding examples
§ Assign:

§ Equal to:

§ Not equal to:

§ Less than:

§ Greater than:

§ Less than or equal to:

§ Greater than or equal to:


Values and Types

§ Value: a text or a number assigned to a variable

§ Integer (int): Positive or negative whole numbers, e.g.,: 8 or -4


§ Float (float): Numbers with a decimal point, e.g.,: 3.14159
§ String (str): text, e.g.,: “Welcome to the Business Lab”
§ Boolean (bool): True or False
§ NoneType: None (no value assigned)

§ Use type() to see type of an object


Type conversions

§ Convert int to float, using float():

§ Convert float to int, using int() :


Type conversions

§ Convert float to string, using str():

§ Convert string to int, using int() :


DataTypes matter:

‘Adding’ a number stored as integer(int) and another number stored as string(str):


String operations

§ Concatenate two string variables:

§ Concatenate string variable a and 3 times string variable b:


Assignment operators
Operator symbol Operator name Description
= Assign Assign the value of the right operand to the left operand
+= Addition assignment Add the value of the right operand to the left operand and assign
the result to the left operand
-= Subtraction assignment Subtract the value of the right operand from the left operand and
assign the result to the left operand
*= Multiplication assignment Multiply the left and the right operand and assign the result to the
left operand
/= Division assignment Divide the left operand by the right operand and assign the result
to the left operand
//= Floor division assignment Floor divide the left operand by the right operand and assign the
result to the left operand
**= Exponent assignment Raise the value of the left operand to the power of the the value of
the right operand and assign the result to the left operand
%= Remainder assignment Compute the remainder of dividing the left operand by the value of
the right operand and assign the result to the left operand
Coding examples
§ Addition and assign:

§ Subtract and assign:


User input

§ username = input()

§ Display username:

§ Add a message to the user:


String methods

.lower()

.upper()

.title()
String methods

Note the extra spaces:

§ Use the strip / lstrip /rstip method to removes spaces:

§ Important to clean text data, such as company identifiers, usernames, etc.


String slices

§ A segment of a string is called a slice


§ We can access specific characters by using the bracket operator:

§ The number inside the bracket is called an index


§ Index is an offset from the beginning of the string
p y t h o n

0 1 2 3 4 5
String slices

p y t h o n

0 1 2 3 4 5

§ Select the first letter of a string:

§ Select the last letter of a string

§ Select the first two letters of a string:


String slices

§ Also possible to count backwards:


p y t h o n
-6 -5 -4 -3 -2 -1

§ Select the last letter of a string

§ Select the last two letters of a string:


Errors and debugging

Ariane 5 Flight Failure (1996) Gangnam style (2014)

Source: https://www.geeksforgeeks.org/10-famous-bugs-in-the-computer-science-world/

PayPal error (2007)

Source: https://www.youtube.com/
watch?v=wGeZEUjUKvc
Source: https://edition.cnn.com/2013/07/17/tech/paypal-error/index.html
Errors and Debugging

Types of errors:
• Syntax errors: code cannot be parsed due to violations of the Python programming language:
• e.g., inappropriate indentation, not closing brackets, missing parentheses
• Runtime errors: errors which do not appear until after the program started running
• e.g., misspelling a variable name (NameError), using the wrong type (TypeErrors), attempting to open a file that
doesn not exist, etc.
• Semantic errors: the program runs, but does something else than expected
• Returning a wrong value (i.e., errors in algorithms) or never ending a loop
• Hardest to find
• Important to verify if your code does what you expected it to do
Recommended reading

Think Python: https://greenteapress.com/wp/think-python-2e/


§ Chapters 1 and 2
Upcoming meetings

§ 8 September - PwC Workshop: A questioning mind


PwC Amsterdam
Thomas R. Malthusstraat 5
1066 JR Amsterdam, WestGate 2.
Bring your own device!

§ 19 September - Lecture 2: Functions and Data structures

You might also like