You are on page 1of 13

LAB 03

Part-A
Objective
“Explore a sample dataset to view the power of Big Data.”

Explore a large database


Theory
Certainly! Let's look at an example dataset to show how big data can provide information that
isn't always present in smaller data sets.

Let's utilize a dataset from a retail establishment that keeps track of customer transactions for
this example. The collection includes details about each transaction, such as the time and
date, the goods bought, the total money spent, and the location, age, and gender of the buyer.
We might be able to make some simple inferences from a tiny dataset, such as which products
are most popular or which days of the week have the biggest sales. With a larger dataset,
though, we can delve much further and find more insightful data.

Additionally, we might categories clients based on their purchase patterns using Big Data
approaches like machine learning algorithms, and then we might utilize that data to tailor
marketing promos and campaigns. Our strategy can be customized to each customer's specific
tastes and demands in order to increase the likelihood that we will close a deal. The capacity
to mix various information to provide a more comprehensive picture of client behaviour is
another advantage of big data. We might, for instance, combine our transaction data with
social media activity to track how consumers discuss our brands and products online. We can
learn more about client sentiment by analyzing this data, and we can then utilize that
knowledge to make our goods and services better.

Figure 1 Accessing dataset of given categories


Answers
a. The inventory of ducks in Alaska in 2012 having a value of 226 and CV (%) is 19.7.
b. The inventory of ducks in Hawaii in 2012 having a value of 1275 and CV (%) is 15.3.
c. The customer transaction dataset we discussed previously may be helpful in a number
of ways if I ran a business that needed ducks. First of all, it might aid in my
comprehension of my consumers' purchasing patterns. I was able to determine which
kinds of ducks are the most popular with clients, when they typically purchase ducks
throughout the year, and what factors affect their choices by analyzing the data. I could
use this knowledge to make the most of my stock and make sure I have enough of the
proper kinds of ducks available to satisfy client demand. Second, the dataset might
enable me to tailor my marketing initiatives. I could design personalized marketing
efforts that appeal to each customer's unique interests and preferences by segmenting
my customers based on their purchasing patterns. For instance, I could design special
offers for clients who frequently purchase a particular breed of duck or send
specialised emails to clients who haven't purchased ducks in a while to entice them to
return to my shop.
Thirdly, the dataset can enable me to spot potential markets for fresh goods or
services. I might discover from the data analysis that clients frequently purchase ducks
for a particular use, such as breeding or hunting. Then, I might think about extending
my product line to include relevant goods or services that might be of interest.

Conclusions
In this discussion, we talked about the value of big data and how it can be utilized to
discover insights that smaller datasets might miss. To illustrate how Big Data may assist
a firm in understanding consumer behaviour, personalizing marketing initiatives, and
seeing chances for new goods or services, we utilized the example of a retail store
transaction record. We also talked about how to segment customers using machine
learning algorithms and how to create a more comprehensive picture of customer
behaviour by merging different datasets. In conclusion, firms aiming to acquire a
competitive edge can use big data as a potent tool. Businesses can make data-driven
decisions that improve results for the company and customers by analyzing vast
amounts of data.
Part-B
Using Excel to Forecast
Theory
Excel is an effective tool for making predictions about the future based on historical
data. The fundamental steps to making a forecast in Excel are as follows:
The historical data should be entered into an Excel spreadsheet. Make sure the
information is presented chronologically, with the most current information at the
bottom. Select the data by selecting it, then select the "Insert" tab, then select
"Recommended Charts." Excel will create a chart for you if you choose the "Line" chart
type. Right-click the chart and choose "Add Trendline." Decide whether you want to
use a linear or exponential trendline. Check the "Display Equation on Chart" option in
the Trendline Options menu. This will display the trendline formula. Forecast future
values using the trendline formula. Simply input future dates into a new column and
apply the algorithm to compute anticipated numbers.
Forecasting using historical data can be incorrect if the data is not reflective of future
conditions or if the underlying causes that drive the data have changed significantly.
when a result, it is critical to examine and revise the forecast on a frequent basis when
new data becomes available.

Step-1
Input the data

Figure 2 Forecasting data on excel


Figure 3 Graph of Forecasting data

Step-3

Figure 4 By changing the confidence to 98%

Answers
1. Increasing the confidence level from 95% to 98% would therefore broaden the forecast
range, providing a higher degree of certainty that the true value of the projection will
fall within that range. As a result, at a 98% confidence level, the range of grades would
be greater than at a 95% confidence level.
2. Forecasting is an important element of big data research and can be utilized in a variety
of ways. Here are three scenarios in which predicting could be useful in big data:
Sales Forecasting: Large corporations utilize big data analytics to forecast sales of their
products or services. They can anticipate future sales for different locations, time
periods, and items by analyzing their sales history, demographics, and customer
behaviour. This data assists them in allocating resources, planning production, and
optimizing pricing tactics.
Big data analytics is used by financial institutions such as banks and investment
businesses to forecast financial markets and economic indices such as GDP, inflation,
and interest rates. Financial forecasting enables them to make sound financial
decisions, detect risks, and assess prospective returns on investment.
Supply Chain Forecasting: To forecast their supply chain activities, large corporations
use big data analytics. They can estimate demand for their products, optimize
inventory levels, and eliminate waste by analyzing their inventory levels, lead times,
and manufacturing capacity. Supply chain forecasting assists them in reducing costs,
increasing efficiency, and improving customer satisfaction.

Conclusions
Finally, forecasting is a useful tool for making educated decisions in a variety of businesses,
including sales, finance, and supply chain management. It assists businesses in optimizing
their resources, reducing risks, and improving their operations. Companies may develop
accurate and dependable forecasts utilizing big data analytics, which can provide significant
insights for their business plans. In addition, I have stated that the amount of confidence in
the forecast can have a substantial impact on the forecast range. A higher confidence level
broadens the forecast range, increasing the likelihood that the true value of the forecast will
fall within that range.
PART-C
Python Programming

Creating Functions
In Python, you can create your own functions using the def keyword followed by the function
name and the parameters in parentheses. Here's an example of a function that adds two
numbers together:

def add_numbers(x, y):

sum = x + y
return sum

In this example, the function is named add_numbers, and it takes two parameters, x and y.
The function then adds x and y together and stores the result in a variable named sum. Finally,
the function returns the value of sum.

To use this function, you would simply call it and pass in two numbers as arguments:

result = add_numbers(3, 5)
print(result) # Output: 8

Conditions and Loops

In Python, you can use conditions and loops to control the flow of your program.

Conditions
You can use the if, elif, and else keywords to create conditional statements in Python. Here's
an example:
x = 10
if x > 5:

print("x is greater than 5")

elif x == 5:

print("x is equal to 5")

else:
print("x is less than 5")

In this example, the program checks if x is greater than 5. If it is, it prints the string "x is greater
than 5". If x is equal to 5, it prints the string "x is equal to 5". If x is less than 5, it prints the
string "x is less than 5".

Loops
You can use loops to execute a block of code repeatedly. Python has two types of loops: for
loops and while loops.

for loops
A for loop can be used to iterate over a sequence of items, such as a list or a string. Here's an
example:

fruits = ["apple", "banana", "cherry"]

for fruit in fruits:

print(fruit)

In this example, the program creates a list of fruits, and then uses a for loop to iterate over
each fruit in the list. For each fruit, it prints the name of the fruit to the console.

while loops
A while loop can be used to execute a block of code repeatedly as long as a condition is true.
Here's an example:
count = 0

while count < 5:


print(count)
count += 1

In this example, the program initializes a variable count to 0, and then uses a while loop to
print the value of count to the console and increment it by 1, as long as count is less than 5.

These are just some basic examples of conditions and loops in Python. There are many other
ways to use these control structures to create more complex programs.

Python Modules

In Python, a module is a file containing Python definitions and statements. These definitions
can be functions, classes, variables, or other Python objects, and they can be used in other
Python programs as needed. Python modules allow you to organize your code into reusable,
shareable components, making it easier to write, test, and maintain complex Python
programs. By using modules, you can break your program down into smaller, more
manageable parts, and you can reuse those parts across multiple programs or projects.
Python comes with a large number of built-in modules that provide a wide range of
functionality, from basic operations like math and string manipulation, to more advanced
features like network programming, web development, and data analysis. In addition to these
built-in modules, there are also thousands of third-party modules available that can be
downloaded and used in your Python programs.

To use a module in your Python program, you first need to import it using the import
statement. For example, if you want to use the math module, which provides functions for
mathematical operations, you can import it like this:

import math

# Now you can use functions from the math module, such as pi and sin
print(math.pi)
print(math.sin(0.5))

You can also import specific functions or classes from a module using the from keyword. For
example, if you only need the sqrt function from the math module, you can import it like this:
from math import sqrt

# Now you can use the sqrt function directly, without needing to prefix it with "math."
print(sqrt(25))

Python modules can also have their own executable code that runs when the module is
imported. This code is usually used to initialize the module or perform some setup tasks. To
separate this code from the code that defines the module's functionality, it's common to
include it in a block of code that only runs when the module is run as the main program, using
the if __name__ == "__main__": statement.

Python Errors
In Python, errors are called exceptions, and they occur when something goes wrong during
the execution of a program. Python provides several built-in exceptions for handling
common errors, such as syntax errors, name errors, and type errors. When an exception
occurs, Python stops executing the program and raises an exception object, which contains
information about the error that occurred.
Here are some common types of exceptions in Python:

SyntaxError: This error occurs when the Python interpreter encounters an error in the syntax
of your code. For example, if you forget to close a parenthesis or put a colon in the wrong
place.

NameError: This error occurs when you try to use a variable or function that has not been
defined. For example, if you try to use a variable that you haven't assigned a value to.

TypeError: This error occurs when you try to use a value of the wrong type. For example, if
you try to add a string and an integer.

ValueError: This error occurs when you try to use a value that is not valid for the function or
method you are using. For example, if you try to use a negative value with the math.sqrt()
function.

IndexError: This error occurs when you try to access an element of a sequence (like a list or
string) that does not exist. For example, if you try to access the 10th element of a list that only
has 5 elements.
To handle exceptions in Python, you can use a try/except block. The try block contains the
code that may raise an exception, and the except block contains the code that should be
executed if an exception occurs. For example:

try:
# some code that may raise an exception
x=1/0
except ZeroDivisionError:
# code to handle the exception
print("Error: division by zero")

In this example, the code inside the try block attempts to divide 1 by 0, which raises a
ZeroDivisionError. The code inside the except block is executed, which prints an error
message.

Combining Python Knowledge and Understanding

Here's an example program that takes a list of integers as input, calculates the average of
those integers, and prints the result:

# get input from user

nums = input("Enter a list of integers, separated by spaces: ")

# convert input to a list of integers

num_list = [int(x) for x in nums.split()]

# calculate the average

avg = sum(num_list) / len(num_list)

# print the result


print("The average is:", avg)

Let's break down how this program works:


The program prompts the user to enter a list of integers, separated by spaces, using the
input() function.
The split() method is used to split the input string into a list of strings, and the int() function
is used to convert each string to an integer. This creates a list of integers.

The sum() function is used to calculate the sum of the integers in the list, and the len()
function is used to get the number of integers in the list. These values are used to calculate
the average.

The print() function is used to print the average.


Here's an example of how this program might be used:

Enter a list of integers, separated by spaces: 1 2 3 4 5


The average is: 3.0

This program demonstrates several key Python concepts, including user input, list
manipulation, mathematical operations, and output using the print() function.

Conclusions
Overall, these subjects are crucial to Python programming and must be understood by any
Python developer. You will be able to develop more efficient, maintainable, and robust Python
programmes if you grasp these ideas. Python modules are files that contain Python code,
which can be imported and used in other Python programs. We discussed how to import
modules using the import statement, and how to access functions and variables defined in a
module using dot notation.
We also discussed Python errors, which are called exceptions in Python. We covered some
common types of exceptions, such as SyntaxError, NameError, and TypeError, and how to
handle exceptions using the try/except and finally blocks.
Postlab Exercises
Exercise 1
Automating Everyday Event

Objective
“Imagine daily activities that would make your life easier if they were
automated.”
1.

Activity How would the activity be automated?


Email sorting and If you receive a lot of emails, automating the process of sorting and
filtering filtering your emails can save you a lot of time. You can use tools like
filters or rules to automatically categorize emails based on sender,
subject, or content .
Social media If you manage social media accounts for yourself or your business,
management automating tasks like posting content, scheduling posts, and responding
to messages can save you a lot of time.
Task reminders and If you have a lot of tasks to complete during the day, automating task
scheduling reminders and scheduling can help you stay organized and on track. You
can use apps like Taoist or Trello to schedule and manage your tasks.

Online shopping If you frequently shop online, automating the process of finding deals
and coupons can save you money and time. Tools like Honey or Rakuten
can automatically find and apply discounts and cashback offers.

News and content If you want to stay up-to-date on news and trends in your industry,
curation automating the process of content curation can save you time. You can
use tools like Google Alerts or Feedly to automatically find and curate
content based on your interests.

2.
https://zety.com/blog/automate-life
https://www.trendhunter.com/slideshow/automated-technology
https://brainly.in/question/53276295#:~:text=Creating%20a%20web%2
Dbased%20calendar%20reminder%20for%20birthdays%2C%20using%20
a,personal%20automation%20can%20be%20done.

You might also like