Skip to main content
Data Analytic
Fundamentals
Day 1
Muhammad Ansyar Rafi Putra S.T., M.Sc.
DevSecOps Engineer
Education:
S2 Spacecraft Design at Lulea Technology University
Skills:
Proficient Data Engineer and Data Analyst with a robust background in
transforming raw data into actionable insights, optimizing data pipelines, and
utilizing advanced tools to drive data-driven decision-making. With a deep
understanding of data architecture and analytics, excels in designing and
implementing efficient data solutions that support business intelligence and
performance management.
Data Analytics Journey
Intro to Data Analytics
https://www.atlassian.com/agile/product-management/product-analytics
Data Analytics
❑ Data analytics refers to methods that professionals employ to deduce conclusions
from data-based models. A lot of the processes of analytics in use today come in
the form of algorithms that professionals can tweak and automate to provide
useful, real-time business intelligence insights for stakeholders. Analytics insights
draw important contexts and inferences from massive quantities of data that can
reveal trends and metrics that businesses can benefit from tracking
Taxonomy of the three analytics questions
Introduction to Data Generation
● Companies now produce vast amounts of data from:
○ Business applications
○ Social media
○ Smartphones
○ IoT sensors and software
Define data analytics and its importance
Categories of Data Analytics
● Descriptive Analytics
● Predictive Analytics (Most dynamic)
● Diagnostic Analytics
● Prescriptive Analytics
Predictive Analytics (PA)
● Advanced statistical approach with AI-based algorithms
● Forecasts uncertain future events
● Uses historical and transactional data to predict trends
Importance of Data Analytics
Importance of Data Analytics
● Valuable for companies with the right resources
● Data analytics methods help organize and analyze this data
Predictive analytics value chain
Benefits of Predictive
Analytics
● Helps define future
risks and
opportunities
● Provides
data-driven
insights for
decision-making
● Focuses on
evidence over
intuition
https://www.atlassian.com/agile/product-management/product-analytics
The Important of Data Analytics
Future Predictions: Big data helps predict future trends and outcomes, not just review past
events.
Understanding Causes: It helps identify the root causes of outcomes, improving decision-making
compared to simple statistics.
Better Customer Insights: Big data allows for more detailed customer profiles by analyzing
diverse data sources.
Real-Time Risk Analysis: It improves the accuracy of risk assessments and forecasts, helping in
proactive decision-making.
Handling Complex Data: Big data tools can manage and make sense of both structured and
unstructured data.
Informed Decisions: It helps in making well-informed decisions by providing actionable insights
from various data sources.
https://www.atlassian.com/agile/product-management/product-analytics
Data Analytics Process
Data Analytics Definition:
● Decomposes data into components for detailed examination.
● Combines components to generate insights.
Industry Contributions:
● Leading vendors like SAS, IBM, Oracle, and Microsoft have developed process models.
● These models focus on different aspects of analytics, particularly from a business
perspective.
Academic and Industry Influence:
● Multiple process models proposed over the last 20 years.
● Emphasizes the evolving nature of data analytics in both academia and industry.
This process tends to highlight a value-chain methodology and offers some valid
points. These steps include:
Set Goals: Decide what the data science team should achieve.
Find Key Metrics: Identify important metrics that impact business performance.
Gather Data: Collect data from various sources.
Clean Data: Improve data by fixing errors and removing unnecessary information.
Create Models: Build models to find insights and make recommendations.
Build the Team: Assemble teams for data analysis and management.
Improve and Repeat: Continuously refine the process for better results.
The 7-step data analytics life cycle process model.
This approach focuses on
identifying business needs
first, then applying data
analysis. It ensures the results
are useful and lead to
decisions that improve the
system.
Data science process model
Another process
model, is offered by
Cathy O’Neil and
Rachel Schutt. This
model, illustrated
below, starts with
collection of raw data
from the world,
KDD—Knowledge Discovery Databases
3 CRISP-DM Process Model
Product Analytics
https://www.atlassian.com/agile/product-management/product-analytics
Product Analytics
❑ Product analytics is a data analysis process that focuses on how users interact with
a product, which is then viewed, visualized and analyzed using various analytical
tools
❑ Product analytics are used to study users' experiences in using the product so they
can better understand what things need to be improved and have an impact on
the business
https://mixpanel.com/content/guide-to-product-analytics/chapter_1/#product-bring-value
Product Analytics
How can I monetize my product?
https://mixpanel.com/content/guide-to-product-analytics/chapter_1/#product-bring-value
Example of Product Analytics
Payment gateways use product analytics to find out user habits such as which payment
accounts they often use, where payment locations are, and whether there is potential for
fraud from the transaction data with the analytical tools used, namely Tableau
Metrics of Product Analytics
❑ Engagement The frequency and cadence of key actions
❑ Revenue Sales revenue generated
❑ Conversion Driving purchases, sign-ups, form-fills, etc.
❑ Retention Users coming back
❑ Activation A user’s first value moment
❑ Active usage Daily, weekly, monthly, or even annually active users
❑ NPS Customer satisfaction
https://mixpanel.com/blog/product-management-metrics-and-analytics/
Types Data Analytics
https://iterationinsights.com/article/where-to-start-with-the-4-types-of-analytics/
Types Data Analytics
https://www.linkedin.com/pulse/5-types-data-analytics-murali-ravi
Descriptive
Analytics
Describing or summarising the existing data using existing business
intelligence tools to better understand what is going on or what has
happened. Examples of descriptive analytics are standard reports,
customer behavior, customer profitability, past competitor actions,
monthly profit and loss statement, and demographic information
Diagnostic
Analytics
Focus on past performance to determine what happened and why. The
result of the analysis is often an analytic dashboard. This type of analytics
typically tries to go deeper into a specific reason or hypotheses based on
the descriptive analytics. While descriptive analytics cast a wide net to
understand the breadth of the data, diagnostic analytics goes deep,
probing into the costs of issues
Predictive Analytics The predictive analytics goes a step ahead of descriptive analytics. While
descriptive analytics is limited to past data, predictive analytics predicts
future trends. It is crucial to remember that predictive analysis only
forecasts the future and not actually predicts it with hundred percent
accuracy. This type of analytics can help the client answer questions like,
what are my customers likely to do in the future? What are my
competitors likely to do? What will the market look like? How will the
future impact my product or service?
Types Data Analytics
https://www.linkedin.com/pulse/5-types-data-analytics-murali-ravi
Prescriptive
Analytics
Prescriptive analytics is about providing advice. Before the decisions
are finalized, It’s an attempt to measure the effect of future decisions
and to advise on possible outcomes. Prescriptive analytics along
with predicting what will happen, it also helps understand why it will
happen, with list of recommendations concerned to actions that will
take advantage of the predictions. This analytics is more advanced
than descriptive and predictive analytics as they recommend a
possible course of action
Autonomous
Analytics
also called Cognitive analytics is an adaptive and continuous system
that learns from the behavioral interventions and actions taken by
customers to automatically change their recommendations and try
out new measures. Adaptive and autonomous analytics provides
answers to the question how does the system adapt to changes?
How can we run analytic solutions on a continuous mode?
Constantly learning and correcting its behavior to optimize its
performance
Types Data Analytics
Types Data Analytics
https://iterationinsights.com/article/where-to-start-with-the-4-types-of-analytics/
Types Data Analytics
https://www.linkedin.com/pulse/5-types-data-analytics-murali-ravi
Descriptive
Analytics
Describing or summarising the existing data using existing business
intelligence tools to better understand what is going on or what has
happened. Examples of descriptive analytics are standard reports,
customer behavior, customer profitability, past competitor actions,
monthly profit and loss statement, and demographic information
Diagnostic
Analytics
Focus on past performance to determine what happened and why. The
result of the analysis is often an analytic dashboard. This type of analytics
typically tries to go deeper into a specific reason or hypotheses based on
the descriptive analytics. While descriptive analytics cast a wide net to
understand the breadth of the data, diagnostic analytics goes deep,
probing into the costs of issues
Predictive Analytics The predictive analytics goes a step ahead of descriptive analytics. While
descriptive analytics is limited to past data, predictive analytics predicts
future trends. It is crucial to remember that predictive analysis only
forecasts the future and not actually predicts it with hundred percent
accuracy. This type of analytics can help the client answer questions like,
what are my customers likely to do in the future? What are my
competitors likely to do? What will the market look like? How will the
future impact my product or service?
Types Data Analytics
https://www.linkedin.com/pulse/5-types-data-analytics-murali-ravi
Prescriptive
Analytics
Prescriptive analytics is about providing advice. Before the decisions
are finalized, It’s an attempt to measure the effect of future decisions
and to advise on possible outcomes. Prescriptive analytics along
with predicting what will happen, it also helps understand why it will
happen, with list of recommendations concerned to actions that will
take advantage of the predictions. This analytics is more advanced
than descriptive and predictive analytics as they recommend a
possible course of action
Autonomous
Analytics
also called Cognitive analytics is an adaptive and continuous system
that learns from the behavioral interventions and actions taken by
customers to automatically change their recommendations and try
out new measures. Adaptive and autonomous analytics provides
answers to the question how does the system adapt to changes?
How can we run analytic solutions on a continuous mode?
Constantly learning and correcting its behavior to optimize its
performance
Types Data Analytics
Introduction to Python
What is Python?
• Python is interpreter
language Guido van
Rossum, released in
1991.
• Python is a
programming language
that lets you work more
quickly and integrate
your systems more
effectively. (python.org)
What is Python?
Python is interpreted
language, what is interpreter
language?
Set up Python environment (installing Python,
IDEs like Jupyter Notebook or PyCharm)
Download Python:
● Go to the Python website.
● Download the latest version (Python 3.x).
Install Python:
● Run the installer.
● Make sure to check the box that says "Add Python to PATH" during installation.
● Follow the installation prompts.
Verify Installation:
● Open a terminal (Command Prompt on Windows, Terminal on macOS/Linux).
● Type python --version or python3 --version and press Enter to check the installation.
Verify the Setup
1. Open Jupyter Notebook or
PyCharm.
2. Test the Installation:
○ Create a new file or
notebook.
○ Write a simple script to test:
Scripting vs Compiling Language
Applications of Scripting Languages :
● To automate certain tasks in a program
● Extracting information from a data set
● Less code intensive as compared to traditional programming languages
● Applications of Programming Languages :
● They typically run inside a parent program like scripts
● More compatible while integrating code with mathematical models
● Languages like JAVA can be compiled and then used on any platform
Why we learn to Python?
1. Easy to develop
2. Can create to develop
many products (Website,
Desktop, and Machine
Learning Model)
How to create Python Script
• We can write in editor
like notepad, and etc to
save python script.
• To create python script,
you can save using
notepad as
script_name.py (all
extensions) or run a
command python
script_name.py.
5 Rule to Write Python
• How to Write Statement
• String
• Naming Convention
• Programming Block of
Statement
• Comment
Write a statement
• Statement is instruction
or command that will be
executed by computer.
• Python use semicolon (;)
to divide two
statements in one line.
String
• String is compound of
character.
• String is written by
using double quote (“ ”)
or single quote (‘ ’).
• You can enter new line
on string by using triple
of double quote (“”” “””)
Naming Convention
• Python is case sensitive
means you need to
comply on capital or
lowercase (e.g: judul,
Judul)
• If you defined a variable
name as judul, and you
call your variable as Judul,
it will show up an error
(variable is not found)
• Python is using snake
case to define variable
means every words must
split by underscore ( _ )
(e.g: angka_pertama,
sisa_bagi)
Comment
• Comment is one or many lines
that will be not execute to give
any knowledge about what is
python script file using for to
another programmer.
• Comment also can be used for
skip any instructions in Python.
• There are many ways to write a
comment in python:
1. Use number sign/hash symbol
(#).
2. Use triple of number sign/hash
symbol (###).
3. Use double quote or single quote
(“ “) atau (‘ ‘).
4. Use triple of double quote (“”” “””).
Variable and Data Type in Python
• Variable is a place to
store a data, meanwhile
data type is content that
we store.
• Variable is mutable
means its value can be
changed.
Data Type in Python
List
• Lists are the most versatile of Python's compound data types. A list contains items
separated by commas and enclosed within square brackets ([]).
• To some extent, lists are similar to arrays in C. One difference between them is that
all the items belonging to a list can be of different data type.
• The values stored in a list can be accessed using the slice operator ( [ ] and [ : ] ) with
indexes starting at 0 in the beginning of the list and working their way to end-1.
• The plus ( + ) sign is the list concatenation operator, and the asterisk ( * ) is the
repetition operator.
List
list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]
tinylist = [123, 'john']
print(list) # Prints complete list
print(list[0]) # Prints first element of the list
print(list[1:3]) # Prints elements starting from 2nd till 3rd
print(list[2:]) # Prints elements starting from 3rd element
print(tinylist * 2) # Prints list two times
print(list + tinylist) # Prints concatenated lists
Output:
['abcd', 786, 2.23, 'john', 70.2]
abcd
[786, 2.23]
[2.23, 'john', 70.2]
[123, 'john', 123, 'john']
['abcd', 786, 2.23, 'john', 70.2, 123, 'john']
Tuple
• A tuple is another sequence data type that is similar to the list. A tuple consists of a
number of values separated by commas. Unlike lists, however, tuples are enclosed
within parentheses.
• The main differences between lists and tuples are: Lists are enclosed in brackets ( [ ]
), and their elements and size can be changed, while tuples are enclosed in
parentheses ( ( ) ) and cannot be updated. Tuples can be thought of as read-only
lists.
Tuple
tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )
tinytuple = (123, 'john')
print(tuple) # Prints complete list
print(tuple[0]) # Prints first element of the list
print(tuple[1:3]) # Prints elements starting from 2nd till 3rd
print(tuple[2:]) # Prints elements starting from 3rd element
print(tinytuple * 2) # Prints list two times
print(tuple + tinytuple) # Prints concatenated lists
OUTPUT:
('abcd', 786, 2.23, 'john', 70.2)
abcd
(786, 2.23)
(2.23, 'john', 70.2)
(123, 'john', 123, 'john')
('abcd', 786, 2.23, 'john', 70.2, 123, 'john')
Dictionary
• Python 's dictionaries are hash table type. They work like associative arrays or
hashes found in Perl and consist of key-value pairs.
• Keys can be almost any Python type, but are usually numbers or strings. Values, on
the other hand, can be any arbitrary Python object.
• Dictionaries are enclosed by curly braces ( { } ) and values can be assigned and
accessed using square braces ( [] ).
Dictionary
dict = {}
dict['one'] = "This is one"
dict[2] = "This is two“
tinydict = {'name': 'john','code':6734, 'dept': 'sales'}
print(dict['one']) # Prints value for 'one' key
print(dict[2]) # Prints value for 2 key
print(tinydict) # Prints complete dictionary
print(tinydict.keys()) # Prints all the keys
print(tinydict.values()) # Prints all the values
OUTPUT:
This is one
This is two
{'dept': 'sales', 'code': 6734, 'name': 'john'}
['dept', 'code', 'name']
['sales', 6734, 'john']
Define a variable
• Variable can be defined with
format
• (nama_variabel = <nilai>).
• We can see what is inside its
variable with using command
print.
How to convert data type
Function Description
int(x [,base]) Converts x to an integer. base specifies the base if x is a string.
long(x [,base] ) Converts x to a long integer. base specifies the base if x is a string.
float(x) Converts x to a floating-point number.
complex(real [,imag]) Creates a complex number.
str(x) Converts object x to a string representation.
repr(x) Converts object x to an expression string.
eval(str) Evaluates a string and returns an object.
tuple(s) Converts s to a tuple.
list(s) Converts s to a list.
set(s) Converts s to a set.
dict(d) Creates a dictionary. d must be a sequence of (key,value) tuples.
frozenset(s) Converts s to a frozen set.
chr(x) Converts an integer to a character.
unichr(x) Converts an integer to a Unicode character.
ord(x) Converts a single character to its integer value.
hex(x) Converts an integer to a hexadecimal string.
oct(x) Converts an integer to an octal string.
Input - Output
• This is how we are
processing tasks
• Input is prerequisites of
doing task
• Process is how to do
task
• Output is result of task
Input – Output (Example)
• Eating:
○ Input: Food
○ Process: Human Digestion
System
○ Output: Energy
Input – Output (Example)
• Calculator:
○ Input: Numbers
○ Process: Math Operations
(Addition, Substraction,
Multiply, Divison)
○ Output: Number
How to get input from keyboard
• Python use input() to
take inputs from
keyboard.
• If we define variable to
store input means its
variable will store
anything that we type
on keyboard.
Output
• To show teks in our
console use print()
command.
• print() command must
insert with string. To
combine between string
and variable, python
must use (+).
Use string format()
• format() is use to concat
between variable and
text menggabungkan isi
variabel dengan teks.
• {} on sentence will be
replaced by value of
variable nama.
Conditional If
What If?
What If?
What If?
• Conditional If can be
used to choose path of
workflow.
• Example:
• 1. Exam
• 2. License Age Eligibility
Example
• "If 'lulus' equals 'tidak',
then print the text 'you
must take a remedial
course'."
• We utilize the equality
operator (==) to compare
the content of the variable
'lulus.' Meanwhile, the
colon (:) signifies the
commencement of the If
code block.
• Proper indentation with a
tab or two spaces is
required when writing an
If code block.
Another Example
• In addition to the If
block, there is also an
Else block that will be
executed when the
condition 'umur >= 18' is
false (False).
Nested If
• The If/Elif/Else
branching structure is
used when there are
more than two decision
options.
• The keyword 'elif' stands
for 'else if,' and its
purpose is to create
additional conditions or
logic if the initial
condition is false.
Looping
Looping
• In programming, loops are used to instruct the computer to perform a task
repeatedly. There are two types of loops in the Python programming language: 'for'
loops and 'while' loops.
• A 'for' loop is commonly referred to as a counted loop because it is typically used
when you already know how many times you want to repeat a piece of code. You
specify a range or sequence over which the loop should iterate, and it executes the
code for each item in that sequence.
• On the other hand, a 'while' loop is known as an uncounted loop because it is used
for situations where you have a condition that determines whether the loop should
continue running or not. The loop continues to execute as long as the specified
condition remains true, and you may not know in advance how many iterations will
occur. In summary, 'for' loops are suitable for scenarios where you have a
predetermined number of iterations, while 'while' loops are used when the number
of iterations depends on a specific condition.
Looping - For
• The variable 'indek' is
used to store an index,
and the 'range()'
function is used to
create a list with values
within a specified range.
Looping – Example For
First, we determine that
the loop should iterate 10
times. The variable 'i' is
used to store the index,
and the 'range()' function is
employed to create a list
within the range of 0 to 10.
The 'str()' function is
utilized to convert an
integer data type to a
string.
Looping – Example While
• First, you define a
variable for counting
and specify when the
loop should stop. If the
user answers "no," the
loop will terminate.
• Perform a loop with
'while', then increment a
counting variable each
time it iterates.
• Afterward, ask the user
whether they want to
stop looping or not.
Function
Function
• In the development of
complex programs with
numerous features, it is
essential to use
functions.
• Functions allow us to
break down large
programs into simpler
sub-programs.
• Each feature of the
program can be
encapsulated within a
separate function. When
we require a particular
feature, we can simply
call the corresponding
function.
Function example
• The 'Salam()' code below
is used to invoke or
retrieve the content of a
function named
'salam()'. Essentially,
whatever is inside the
function will be
executed when it is
called.
• Functions can also be
called within other
functions, and they can
even call themselves. A
function that calls itself
is known as a recursive
function.
Function with parameter
• Now, what if we want to
provide input values to a
function? We can use
parameters for this
purpose.
• Parameters are variables
that store values to be
processed within a
function.
Function that returns a value
• A function that does not
return a value is usually
referred to as a procedure.
• However, there are times
when we need the result
of a function to be used in
the subsequent process.
In such cases, the function
must return a value from
its processing.
• The way to return a value
is by using the 'return'
keyword, followed by the
value or variable that
needs to be returned.
Global and local variables
• When we use functions, we need to be aware of the concepts of Global and Local
variables.
• A Global variable is a variable that can be accessed from all functions, while a Local
variable can only be accessed within the function where it is defined. In Python, the
order of variable access (scope) is known as LGB (Local, Global, and Built-in).
• So, in Python, the program first looks for a local variable, and if it exists, that's what
is used. Built-in variables are those that are already present in Python.
HandsOn
Pop Up Quiz
Assignment
Ketentuan:
1. Dikerjakan dengan menggunakan Jupyter NoteBook
2. Sertakan penjelasan singkat
3. Kumpulkan dalam bentuk PDF ke LMS
4. Dikumpulkan sebelum pertemuan berikutnya
Soal:
1. Buatlah contoh fungsi dengan program python yang dapat menjumlahkan 5
angka
2. Buatlah contoh pengulangan for dan while loop
3. Buatlah contoh fungsi yang dapat menghitung pangkat dari sebuah bilangan.
THANK YOU
Wisma Barito Pacific
Lantai 1 A Blok G, Jln. Letjend S.Parman Kav
62-63, Slipi, Palmerah Jakarta