Introduction of Instagram Reach Analysis
OBJECTIVES OF THE PROJECT
Reach tells you how many unique users are served your content every day. Try to maximize this
metric to increase brand awareness. Instagram Impressions: The number of times your content,
whether a post or a story, was shown to users.
Instagram is one of the most popular social media applications today. People using Instagram
professionally are using it for promoting their business, building a portfolio, blogging, and creating
various kinds of content. As Instagram is a popular application used by millions of people with
different niches, Instagram keeps changing to make itself better for the content creators and the
users. But as this keeps changing, it affects the reach of our posts that affects us in the long run.
So if a content creator wants to do well on Instagram in the long run, they have to look at the data
of their Instagram reach. That is where the use of Data Science in social media comes in. If you
want to learn how to use our Instagram data for the task of Instagram reach analysis, this article
is for you. In this article, I will take you through Instagram Reach Analysis using Python, which will
help content creators to understand how to adapt to the changes in Instagram in the long run.
System requirements :
● Memory 16GB minimum
● Hard Drive SSD is preferred 500GB minimum (or 256 GB and an external hard drive
● CPU Intel i5 minimum Intel i7 or i9 preferred (M1 and M2 NOT recommended)
● Operating Systems Windows 10 or 11 (Home or Pro) Mac: High Sierra or later
DATA ANALYSIS :
Instagram is one of the most popular social media applications today. People using
Instagram professionally are using it for promoting their business, building a portfolio,
blogging, and creating various kinds of content. As Instagram is a popular application
used by millions of people with different niches, Instagram keeps changing to make itself
better for the content creators and the users. But as this keeps changing, it affects the
reach of our posts that affects us in the long run. So if a content creator wants to do well
on Instagram in the long run, they have to look at the data of their Instagram reach. That
is where the use of Data Science in social media comes in. If you want to learn how to use
our Instagram data for the task of Instagram reach analysis, this article is for you. In this
article, I will take you through Instagram Reach Analysis using Python,which will help
content creators to understand how to adapt to the changes in Instagram in the long run.
Instagram Reach Analysis
What is data analysis:
Data Analysis is the process of systematically applying statistical and/or logical techniques to
describe and illustrate, condense and recap, and evaluate data.Data analysis is the practice of
working with data to glean useful information, which can then be used to make informed
decisions.
Importance of Data analysis :
An analysis is an in-depth examination of a topic that involves conducting research, collecting
data, and sorting results into smaller topics to reach logical conclusions.
It is very helpful in breaking a macro prblem into micro parts.
An analysis presents targeted arguments on a particular subject and backs them up with data and
evidence
Analysis is essential as it helps businesses understand their customers better, improves sales,
improves customer targeting, reduces costs, and allows for the creation of better problem-solving
strategies.
It helps in structuring the finding form of different sources.
It helps in keeping human bias away from research conclusion with the help of proper statistical
treatment.
Tools and Languages used in Data Analysis
Python:Python is commonly used for developing websites and software, task automation, data
analysis, and data visualization. Since it's relatively easy to learn, Python has been adopted by
many non-programmers such as accountants and scientists, for a variety of everyday tasks, like
organizing finances.
Tableau: The main advantage of the Tableau is data visualization. Tableau helps turn insight into
action, cut down analysis time, and change behaviors that help everyone be more data-driven
across the business. Pfizer deployed Tableau to 25,000 users so teams could collaborate with
data using self-service analytics.
Apache spark:The primary importance of Apache Spark in the Big data industry is because of its
in-memory data processing that makes it high-speed data processing engine compare to
MapReduce. It is an ideal tool for companies that focus on Internet of Things.
SAS:SAS is the leader in analytics. Through innovative Analytics, Artificial Intelligence and Data
Management software and services, SAS helps turn your data .
Microsoft Excel:There are many different Python packages for working with Excel. The majority of
these are for reading and writing Excel files
Power BI:Microsoft Power BI is an interactive data analysis and visualization tool that's used for
business intelligence (BI) and that you can now script with Python.Talentt
Splunk:Splunk is used for monitoring and searching through big data. It indexes and correlates
information in a container that makes it searchable, and makes it possible to generate alerts,
reports and visualizations.
Rapid miner:RapidMiner is a powerful data mining tool that enables everything from data mining
to model deployment, and model operations.RapidMiner is most often used by companies with
>10000 employees and >1000M dollars in revenue.
R:R analytics is data analytics using R programming language, an open-source language used for
statistical computing or graphics. This programming language is often used in statistical analysis
and data mining.
Python for data analytics :
Libraries in python for data analytics
Numpy:
NumPy is a Python library that provides a simple yet powerful data structure: the n-dimensional
array. This is the foundation on which almost all the power of Python's data science toolkit is built,
and learning NumPy is the first step on any Python data scientist's journey.
Pandas:
Pandas is an open-source Python library designed to deal with data analysis and data
manipulation. Citing the official website, “pandas is a fast, powerful, flexible and easy to use open
source data analysis and manipulation tool, built on top of the Python programming language.”
Matplotlib:
Matplotlib is a low-level library of Python which is used for data visualization. It is easy to use and
emulates MATLAB like graphs and visualization. This library is built on the top of NumPy arrays
and consist of several plots like line chart, bar chart, histogram, etc.
Seaborn:
Seaborn is a library for making statistical graphics in Python. It builds on top of matplotlib and
integrates closely with pandas data structures. Seaborn helps you explore and understand your
data.
LOG BOOK FOR FIRST WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Introduction of python We leaned the topic
what is the python
Day 2 Installation and basic How to install python
python programs in pc
We leaned python
basic program
Day 3 Introduction of Build in data types are
datatypes and built in known as primitive
datatypes data types
Day 4 About user defined User defined data
data types types as non primitive
data types.
About queu, tree,
linked, map, and
hashed map
Day 5 Introduction of Introduction and
operators purpose of using
operators
Day 6 Brief discussion of Arithmetic operator
arithmetic operator perform operation on
group of numbers
Ex:+,-,*,/
WEEKLY REPORT FOR FIRST WEEK
Objective of the Activity done:
Detailed Report:
1. Installing python is very easy and now a days many Linux and Unix including a recent
python
2. Now a days even some windows computer come with python already installed
3. Data types in python are the classification and categories of the data items
Symple python programm:
# Python program to
# demonstrate numeric value
a=5
print("Type of a: ", type(a))
b = 5.0
print("\nType of b: ", type(b))
c = 2 + 4j
print("\nType of c: ", type(c))
Output:
Type of a: <class 'int'>
Type of b: <class 'float'>
Type of c: <class 'complex'>
LOG BOOK FOR SECOND WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Brief discussion of Comparison operator
comparison operator used to return
compared values and
return true or false
Day 2 Assignment operator Assign right side
values to the left side
Ex:=,+=, -=,etc
Day 3 Membership operator Membership operator
check value variable
exists in a sequence
or not
Day 4 Logical operator Logical operator is
used to connect two
or more expressions
Day 5 Brief discussion of Today I learnt about
other operator Bitwise and identity
operators
Day 6 Slip test I attended slip test on
previous learner
topics, about
operators and basic
program
WEEKLY REPORT FOR SECOND WEEK
Objective of the Activity done:i conclude the necessary activity about how to work on
numbers using multiple operators
Detailed Report:
● Python operators in genaral are used perform operations on value and variable
● OPERATORS:Are the special symbol. Eg:+,-,*,/,%
● OPERAND:ir is value on which the operator applied
Simple program on operators
a=7
b=2
# addition
print ('Sum: ', a + b)
# subtraction
print ('Subtraction: ', a - b)
# multiplication
print ('Multiplication: ', a * b)
# division
print ('Division: ', a / b)
# floor division
print ('Floor Division: ', a // b)
# modulo
print ('Modulo: ', a % b)
# a to the power b
print ('Power: ', a ** b)
Output:
Sum: 9
Subtraction: 5
Multiplication: 14
Division: 3.5
Floor Division: 3
Modulo: 1
Power: 49
LOG BOOK FOR THIRD WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Concept of Decisions Today learner about
making statement Decision making
statement
Day 2 Discussion of if Learned about if
statement statement syntax and
usage of if statement
Day 3 If else statement If else statement and
simple program init
Day 4 If-elif-else statement It can be multiple
times until the
condition became
true
Day 5 Decision making Decision making is
statement in python anticipation of
condition occuring
while execution of
program
Day 6 Slip test Slip test is conducted
on weekly classes
and i correct all my
mistakes
output:Wednesday
LOG BOOK FOR FOURTH WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Discussed about Replication used to
Replication and write multiple times
capitalise method in and capitalisation
string used to make all
capital letters
Day 2 Brief discussion of String is a sequence
string of character
Day 3 Discussed about list List is mutable and
and tuple tuple is immutable
Day 4 Brief discussion of String indexing means
indexing topic in refering to element of
string an literable by it's
position within the
literable
Day 5 Brief discussion of Slicing means getting
slicing topic in string a subset of elements
from an literable
based on their indices
Day 6 Slip test3 Slip est on weekly
topics and i correct all
my mistakes in these
slip test
output:pearlpearl
LOG BOOK FOR FIFTH WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Discussed about Getting an idea about
statements in python looping statement
and types of looping
statements
Day 2 Discussed about For Today i learned about
loop statement for loop that is used
to iterating over a
sequence
Day 3 Discussed about For The range function
with range statement returns a sequence of
number, starting from
0 to 1by increment by
1
Day 4 Discussed about This loop is used
Multiple for loop inside of another for
statement loop
Day 5 While loop statement While loop executes
till the condition
becam etrue
Day 6 Discussed about You can use while
multiple while loops loop to run same task
for multiple times
Weekly report 5
Objectives of activity done:
Detailed report:Loops in Python
Python programming language provides the following types of loops to handle looping
requirements.
Python provides three ways for executing the loops. While all the ways provide similar basic
functionality, they differ in their syntax and condition-checking time.
While Loop in Python
In python, a while loop is used to execute a block of statements repeatedly until a given condition
is
satisfied. And when the condition becomes false, the line immediately after the loop in the
program is
executed.
Syntax:
while expression:
statement(s)
All the statements indented by the same number of character spaces after a programming
construct
are considered to be part of a single block of code. Python uses indentation as its method of
grouping
statements.
Loops in Python
Python programming language provides the following types of loops to handle looping
requirements.
Python provides three ways for executing the loops. While all the ways provide similar basic
functionality, they differ in their syntax and condition-checking time.
While Loop in Python
In python, a while loop is used to execute a block of statements repeatedly until a given condition
is
satisfied. And when the condition becomes false, the line immediately after the loop in the
program is
executed.
Syntax:
while expression:
statement(s)
All the statements indented by the same number of character spaces after a programming
construct
are considered to be part of a single block of code. Python uses indentation as its method of
grouping
statements.
Example of Python While Loop
Let’s see a simple example of while loop in Python.
# Python program to illustrate
# while loop
count = 0
while (count < 3):
count = count + 1
print("Hello python")
Output:
Hello python
Hello python
Hello python
Using else statement with While Loop in Python
The else clause is only executed when your while condition becomes false. If you break out of the
loop, or if an exception is raised, it won’t be executed.
Syntax of While Loop with else statement:
while condition:
# execute these statements
else:
# execute these statements
Examples of While Loop with else statement
Here is an example of while loop with else statement in Python:
# Python program to illustrate
# combining else with while
count = 0
while (count < 3):
count = count + 1
print("Hello python ")
else:
print("In Else Block")
Output:
Hello python
Hello python
Hello python
In Else Block
Infinite While Loop in Python
If we want a block of code to execute infinite number of time, we can use the while loop in Python
to
do so.
# Python program to illustrate
# Single statement while block
count = 0
while (count == 0):
print("Hello Geek")
Note: It is suggested not to use this type of loop as it is a never-ending infinite loop where the
condition is always true and you have to forcefully terminate the compiler.
For Loop in Python
For loops are used for sequential traversal. For example: traversing a list or string or array etc. In
Python, there is “for in” loop which is similar to for each loop in other languages. Let us learn how
to
use for in loop for sequential traversals.
Syntax:
for iterator_var in sequence:
statements(s)
It can be used to iterate over a range and iterators.
# Python program to illustrate
# Iterating over range 0 to n-1
n = 4 for i in range(0, n):
print(i)
Output :
0
1
2
3
Example with List, Tuple, string, and dictionary iteration using For Loops in Python
We can use for loop to iterate lists, tuples, strings and dictionaries in Python.
# Python program to illustrate
# Iterating over a list
print("List Iteration")
l = ["basic", "of", "python"]
for i in l:
print(i)
# Iterating over a tuple (immutable)
print("\nTuple Iteration")
t = ("basic", "of", "python")
for i in t:
print(i)
# Iterating over a String
print("\nString Iteration")
s = "python"
for i in s:
print(i)
# Iterating over dictionary print("\nDictionary Iteration")
d = dict()
d['xyz'] = 123
d['abc'] = 345
for i in d:
print("%s %d" % (i, d[i]))
# Iterating over a set
print("\nSet Iteration")
set1 = {1, 2, 3, 4, 5, 6}
for i in set1:
print(i),
Output:
■List Iteration
Basic
Of
Python
■Tuple Iteration
Basic
Of
Python
■String Iteration
P
Y
T
H
O
N
■Dictionary Iteration
xyz 123
abc 345
LOG BOOK FOR SIXTH WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Slip test 4 This slip test is
conducted on above
weekly topics
Day 2 Matrix and it's Matrix contains rows
program and columns
Day 3 Discuss about Once a function is
Functions in python defined it can be
called n number of
times
Day 4 Discuss about Variables are called at
Variables the start of the
programm
Day 5 Recollect all the I got an idea about
above topi functions, variables
and Matrix
Day 6 Introduction of An argument is a
Arguments in python value that sent to the
function that it is
called
Weekly report 6
Objectives of daily report:
Detailed report:A matrix is a collection of numbers arranged in a rectangular array in rows and
columns. In the fields of engineering, physics, statistics, and graphics, matrices are widely used to
express picture rotations and other types of transformations.
The matrix is referred to as an m by n matrix, denoted by the symbol “m x n” if there are m .matrix
=
[[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
print("Matrix =", matrix)
Output:
Matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9,10,11,12]
A variable is essentially a place where we can store the value of something for processing later on.
Imagine you wanted to write a program that doubled a number for us, not the most exciting of
programs I know but it is a good example.
We would first want to define a variable to store our number, double it and then print it out.
Open up visual studio code and create a new python file called double.py. In this double.py file
you will
want to add the following code:
my_number = 2
print(my_number)
my_number = my_number * 2
print(my_number)
We start off by defining a new variable called my_number and setting this new variable to equal
When you run this you should see the number 2 being printed out in the console.
>>> my_number = 2
>>> print(my_number)
2
After this we then re-assign our my_number variable to equal the current value of my_number
times 2.
This doubles our starting number. When we now run this program you should see the number 4
being
printed out below our 2 value.
>>> my_number = 2
>>> print(my_number)
2
>>> my_number = my_number * 2
print(my_number)
4
Exercise - Try changing the my_number variable to a series of different numbers to test this out.
Now this example may work with numeric values, but what happens if we want to define a
variable that
stores something like a name? We can do that to simply by choosing a variable name such as
first_name
and then setting this to equal the string of our choice surrounded by quotes like so:
first_name = "Elliot"
print(first_name)
We can then do cool things like printing out custom messages like this:
print("Welcome: " + first_name)
This should then print out Welcome: Elliot to our console when we run it.
Functions in Python
So now that we’ve got a basic understanding of variables in Python, let’s now move on to
functions. If
you’ve never encountered functions before then you can think of them as blocks of instructions,
imagine
you had a maths program that could either double or triple a number of your choice. You would
want to
define two distinct functions that would take in a number and either double or triple it.
def double(my_number):
This is known as a function declaration and it’s below this function declaration that we’ll define
what we
want our function to do. You should notice that we’ve included (my_number) beside our function,
this is
how we define what goes into every function. In this case we want it to take in a my_number
variable
which we will then go on to double within our function.
def double(my_number):
return my_number * 2
Note: we have used the return keyword which returns the value of my_number * 2 whenever this
function is called.
If we then wished to use this function then we could do something like this: def
double(my_number):
return my_number * 2
## create a new variable called `my_var` which equals
## the value returned by calling double() on the value 5.
my_var = double(5)
## print our new
def test_function():
print("Hello World")
print("This is a multi-line function")
print("that does not return anything")
Arguments are the variables passed to the function in the function call.
5 Types of Arguments in Python Function Definitions
Learn about the five different types of arguments used in python function definitions: default,
keyword, positional, arbitrary positional
In Python, a function is defined with def. This is followed by the name of the function and a set of
formal parameters. The actual parameters, or arguments, are passed during a function call. We
can
define a function with a variable number of arguments.
■default arguments
■keyword arguments
■positional arguments
■arbitrary positional arguments
■arbitrary keyword arguments
LOG BOOK FOR SEVENTH WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Types of arguments ● Default
argument
takes default
values
● Keyword
argument
specific
perameter
names
Day 2 Discuss about lamd Lamda function is
function in python small ananimous
function
Day 3 Slip test 5 Take a slip test and
rectify all mistakes
Day 4 Introduction of oops Gained some
concept knowledge about
oops and importance
of oops in python
Day 5 Discuss about object, A structure used to
class, method in oops store data is called
class
Day 6 Discussed about Constructors are
constructors in generally used for
python instantiating an object
Arguments:an argument is a value that is passed to a function when it is
called it might be a variable, value or object passed to a function or method
as input.the arguments are four types:
Required arguments:
#function definition
def display(a,b)
#function call
Display(10,20)
Keyword arguments:
def display (a,b)
print(a,b)
display(b=10,a=15)
output:15,10
default argument:
def display(“name:xyz”,’branch:mba’)
print(name)
print(branch)
display(“name:abc”,’branch:btech’)
display(“name”:”xyz”)
output:
abc:btech
xyz:mba
variable length:
display(“mba”,”mca”,”b.tech”)
output:
mba,mca,b.tech
LAMDA FUNCTIONS:
Lambda(division x,y:x/y)
Print(divide(10,2))
Output:5
CLASS&OBJECT:A structure used to store data is a class
Objectmeans excistingin theworld
Blueprintofa object
Method:
#basic addition program using oops
Class addition():
#class is defined
X=20
Y=20
#variable is declare
Def add(self):
Print(“addition”=selfx+selfy)
#method
Obj=add()
Obj.addition()
Output:40
__IN IT__CONSTRUCTOR:
class GeekforGeeks:
#default constructor
def __init__(self):
self.geek = "GeekforGeeks"
#amethodforprintingdata members
def print_Geek(self):
print(self.geek)
#creatingobject oftheclass
obj = GeekforGeeks()
#callingtheinstancemethodusingtheobject obj
obj.print_Geek()
Output
GeekforGeeks
LOG BOOK FOR EIGHT WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Introduction of Inheritance means
inheritance inheriting data from
one class to another
class
Day 2 Discussed about One base class and
single inheritance one derived classes
are presented in
single inheritance
Day 3 Brief discussion of A class is derived
multi level inheritance from one base class
and return that
derived class became
base class of another
derived class
Day 4 Brief discussion of Class derived from
multiple inheritance more than one base
class
Day 5 Brief discussion of Multiple classes are
Hierarchical created from same
inheritance base class
Day 6 Brief discussion Inheritance consists
Hybrid inheritance multiple inheritance
WEEKLY REPORT
WEEK8(FROMDT_______TODT________)
OBJECTIVE OF THE ACTIVITY DONE:
DETAILED REPORT: In Inheritance is the capability of one class to derive
or inherit the properties from another class.
Benefits of inheritance are:
It represents real-world relationships well.
Benefits It provides the reusability of a code.
Single inheritance:
class Emp(Person):
def Print(self):
print("Empclasscalled")
Emp_details = Emp("Mayank", 103)
#callingparent classfunction
Emp_details.Display()
#Callingchildclassfunction
Emp_details.Print()
Output:
Mmayankayank 103
Emp class called
Multiple inheritance:
Class laptop:
Class smartphone:
Class tablet(laptop,smartphone):
Tab=tablet()
Tab.devices()
Output:
Laptop class
Smartphone class
A derived tablet class
A computer,A smartphone and A tablet
multi-level inheritance:
class principal:
def principle(self):
print(“I am principle”):
class teacher(principal):
def teacher(self):
print(“I am teacher”)
class student(teacher):
def student(self):
print(“I am student”)
d=student()
d.principle()
d.teacher()
d.student()
output:
I am principle
I am teacher
I am student
Hierarchical inheritance:
class Media:
def getMediaInfo(self):
self.__title=input("Enter Title:")
self.__price=input("Enter Price:")
def printMediaInfo(self):
print(self.__title,self.__price)
class Magazine(Media):
def getMagazineInfo(self):
self.getMediaInfo()
self.__pages=input("Enter Pages:")
def printMagazineInfo(self):
print("Magazine information : ")
self.printMediaInfo()
print("Pages:",self.__pages)
class Channel(Media):
def GetChannelInfo(self):
self.getMediaInfo()
self.__freq=input("Enter Frequency:")
def printChannelInfo(self):
print("Channel information : ")
self.printMediaInfo()
print("Frequency:",self.__freq)
print("Enter Magazine information.")
magzineInfo = Magazine()
magzineInfo.getMagazineInfo()
magzineInfo.printMagazineInfo()
print("Enter Channel information.")
channelInfo = Channel()
channelInfo.GetChannelInfo()
channelInfo.printChannelInfo()
Output:
Enter Magazine information.
Enter Title:The times
Enter Price:120
Enter Pages:500
Magazine information :
The times 120
Pages: 500
Enter Title:Star
Enter Price:100
Enter Frequency:250
Channel information :
Star 100
Frequency:250
Hybrid inheritance:
classGrandPa:
def __init__(self):
print("Grand Pa")
classFather(GrandPa):
def __init__(self):
super().__init__()
print("Father")
classMother(GrandPa):
def __init__(self):
super().__init__()
print("Mother")
classchild(Father, Mother):
def __init__(self):
super().__init__()
print("Child")
c = child()
OUTPUT:
GrandPa
Mother
Father
Child
LOG BOOK FOR NINTH WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Brief discussion of polymorphism means
polymorphism and having many forms
types
Day 2 Brief discussion of encapsulation means
encapsulation process of wrapping
similar code in one
place
Day 3 Brief discussion of Abstraction is a
abstraction process of hiding
unwanted information
Day 4 Applications of Abstraction makes
abstraction in python things simpler, easier
to change , easier to
document
Day 5 Introduction of data Installation and
analysis importance of data
analysis
Day 6 Discussion of libraries Leaned about libraries
in data analysis in data analysis
● Numpy
● Pandas
● Matplotlib
● Seaborn
Weekly report9:
Objectives of daily report:
Detailed report:A child class inherits all the methods from the parent class. However, in some
situations, the method inherited from the parent class doesn’t quite fit into the child class. In such
cases, you will have to re-implement method
There are different methods to use polymorphism in Python. You can use different function, class
methods or objects to define polymorphism. So, let’s move ahead and have a look at each of
these
methods in detail.
Polymorphism with Function and Objects
You can create a function that can take any object, allowing for polymorphism.
Let’s take an example and create a function called “func()” which will take an object which we will
name “obj”. Now, let’s give the function something to do that uses the ‘obj’ object we passed to it.
In
this case, let’s call the methods type() and color(), each of which is defined in the two classes
‘Tomato’
and ‘Apple’. Now, you have to create instantiations of both the ‘Tomato’ and ‘Apple’ classes if we
don’t have them already:
class Tomato():
def type(self):
print("Vegetable")
def color(self):
print("Red")
class Apple():
def type(self):
print("Fruit")
def color(self):
print("Red")
def func(obj):
obj.type()
obj.color()
obj_tomato = Tomato()
obj_apple = Apple()
func(obj_tomato)
func(obj_apple)
Output:
Vegetable
Red
Fruit
Red
Abstraction and encapsulation are synonymous as data abstraction is achieved through
encapsulation. Abstraction is used to hide internal details and show only functionalities.
Abstracting
something means to give names to things, so that the name captures the basic idea of what a
function
or a whole program does. Encapsulation is used to restrict access to methods and variables. In
encapsulation, code and data are wrapped together within a single unit from being modified by
accident.
__init__ method: This method is called when an object of the class is created. It initializes the
books
attribute with the passed books list.
list_books method: This method prints the available books list.
borrow_book method: This method takes a book name as an argument and removes it from the
books list if it is present, or prints a message "Book not Available" otherwise.
receive_book method: This method takes a book name as an argument and adds it back to the
book list
The program then creates an object o of the "Library" class, passing the list of books as an
argument.
A menu-driven interface is then created using a while loop, which provides the user with three
options:
Display the list of books
Borrow a book
Return a book
The user is prompted to enter their choice, and the corresponding method of the o object is called
based on the entered choice. If an invalid choice is entered, the program prints a message "Thank
You
come again" and quits.
Source Code
# Abstraction and Encapsulation in Python
class Library:
def __init__(self, books):
self.books = books
def list_books(self):
print("Available Books")
for book in self.books:
print(book)
def borrow_book(self, borrow_book):
if borrow_book in self.books:
print("Get Your Book Now")
self.books.remove(borrow_book)
else:
print("Book not Available")
def receive_book(self, receive_book):
print("You have returned the book")
self.books.append(receive_book)
books = ['C', 'C++', 'Java']
o = Library(books)
msg = """
1.Display Book
2.Borrow Book
3.Return Book
"""
while True:
print(msg)
ch = int(input("Enter Your Choice : "))
if ch == 1:
o.list_books()
elif ch == 2:
book = input("Enter Book Name To Borrow : ")
o.borrow_book(book)
elif ch == 3:
book = input("Enter Book Name To Return : ")
o.receive_book(book)
else:
print("Thank You come )
Output:
1.Display Book
2.Borrow Book
3.Return Book
Enter Your Choice : 1
Available Books
C
C++
Java
1.Display Book
2.Borrow Book
3.Return Book
Enter Your Choice : 2
Enter Book Name To Borrow : C
Get Your Book Now
1.Display Book
2.Borrow Book
3.Return Book
Enter Your Choice : 1
Available Books
C++
Java
1.Display Book
2.Borrow Book
3.Return Book
Enter Your Choice : 3
Enter Book Name To Return : Python
You have returned the book
1.Display Book
2.Borrow Book
3.Return Book
Enter Your Choice : 1
Available Books
C++
Java
Python
1.Display Book
2.Borrow Book
3.Return Book
LOG BOOK FOR TENTH WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Introduction to python Learned about
world anaconda navigator
and uses of python
Day 2 Anaconda navigator Anaconda navigator
and how to use allows users to launch
libraries application and allow
to manage conda
packages without
using commond line
commands
Day 3 Introduction Numpy NumPy created to
library and installation used for working with
arrays
Day 4 Brief explanation of It also has a function
numpy library working with domain
of linear algebra.
Day 5 Introduction panda Panda library is used
library and installation to analyse the data.
Day 6 Brief explanation of Pandas is open
panda library source python
package that is most
widely used for data
science.
Weekly report10:
Objectives of daily report:
Detailed report:Anaconda Navigator is a desktop graphical user interface included in Anaconda
that
allows you to launch applications and easily manage conda packages, environments and
channels
without the need to use command line
NumPy is a Python library used for working with arrays.
It also has functions for working in domain of linear algebra, fourier transform, and matrices.
NumPy was created in 2005 by Travis Oliphant. It is an open source project and you can use it
freely.NumPy stands for Numerical Python.
NumPy can be installed with conda, with pip, with a package manager on macOS and Linux, or
from
source. For more detailed instructions, consult our Python and NumPy installation guide below.
CONDA
If you use conda, you can install NumPy from the defaults or conda-forge channels:
# Best practice, use an environment rather than install in the base env
conda create -n my-env
conda activate my-env
# If you want to install from conda-forge
conda config --env --add channels conda-forge
# The actual install command
conda install numpy
PIP
If you use pip, you can install NumPy with:
pip install numpy
Also when using pip, it’s good practice to use a virtual environment - see Reproducible Installs
below
for why, and this guide for details on using virtual environments.
the two processes to install pandas on WindowsWith pip
With anaconda
Processes to Install Pandas on Windows
1.1 How to install pandas using pip?
If you are using the latest version of Pandas, you will have pip already installed on your system.
Therefore you need not follow from step 1 to 5. For users who don’t have the latest version of
Python
(3.7.3), they should upgrade it.
Step-1
First head over to https://www.python.org and click on Downloads on the Navigation bar as
highlighted
Step-2
Be sure to download the latest version of the Python. Version 3.7.3,
Don’t forget to check – Pandas Basic Functionality
Step-3
On running the downloaded installer, you will get this window. Click on ‘Install Now’.
Step-4
After finishing the installation, it is recommended to choose the option to disable path length to
avoid
any problems with your
Step-5
Now that Python is installed, you should head over to our terminal or command prompt from
where
you can install Pandas. So go to your search bar on your desktop and search for cmd. An
application
called Command prompt should show up. Click to start it.
It’s the right time to discover Pandas Library Architecture (File Hierarchy)
Step-6
Type in the command “pip install manager”. Pip is a package install manager for Python and it is
installed alongside the new
Step-7
Wait for the downloads to be over and once it is done you will be able to run Pandas inside your
Python
It is highly recommended that beginners should use Anaconda to install Pandas on their system.
Installing Anaconda is not only very easy, but it also gives you access to various other tools.
Step-1
Head over to https://www.anaconda.com, Once you are there, click on the Download button on
the
top right corner of the screen.
Step2:
n the downloads page, scroll down until you see the download options for windows. Click on the
download button for python 3.7. This will initiate a download for the
Step-3
Follow through the instructions for installing as shown in the next few images. Choose any
destination
folder according to your liking and uncheck “Add anaconda to my PATH environment variable.”
Add anacoda to PATH environment variable
Anacoda License Agreement
Choose Installation Location
Advanced Installation Options
Installing Pandas
Pandas Installation process complete
Step-4
Once the installation is finished you can have access to Pandas on your system. Anaconda
installs all
importan
LOG BOOK FOR ELEVENTH WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Introduction Matplotlib is a cross
matplotlib library and platform, data
installation visualization and
graphical plotting
library
Day 2 Brief explanation of It allows to create
matplotlib library numerous and diverse
plot type
Day 3 Introduction seaborn Seaborn is python
library and installation data visualization
library based on
matplotlib
Day 4 Brief explanation of Seaborn is a Library
seaborn library that uses matplotlib
underneath to plot
graph
Day 5 Data reading using Row array data
the NumPy and panda written with NumPy.
librar nd array. Ato file
Day 6 Data visualisation Select and transform
using matplotlib and data, then plot it.
seaborn Seaborn stands for
statistical data
visualization.
Weekly report11
Objectives of daily report:
Detailed report: Data analysis is the technique to collect transform an organize data to make
future predictions End make informed data Driven decision it also helps to find possible
solutions for a business problems
matplot library
matlab library is a cross-platform data visualization and graphical plotting library for Python And
its numerical Extension numpy.
A Python matplot library script is structured so that a few lines of code are all that is required in
most instances to generate a visual data plot
seaborn library
Seaborn is a Python data visualization library based on macklot library it provides a high level
interface for drawing attractive and informative statistical graphics
Numpy and panda libraries
Numbi is a mostly used for working with numerical values as it makes it easy to apply
mathematical functions pandas is mostly used for data analysis tasks in Python pandas library
works well for numeric alphabets and heterogeneous type of data.
Data visualization using matplot and seaborn librarieslibraries
Matplot library is a library in Python that enables uses to generate visualization like histograms
scatter plots bar charts pie charts and much more
Seaborn is a visualization library that is built on top of marplot library it provides data
visualizations that are typically more a EST HETIC and statistically sophisticated.
Installing matplot library
Python 3 version pipe
Pip install matplotlib
Command: pip install matplotlib
Installing seaborn:
install the latest version python3 in mac os
Check it pip 3 and python 3 are correctly installed
Upgrade you pip to avoid errors during installation
Enter the following command to install seaborn using pip 3
LOG BOOK FOR TWELVETH WEEK
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Introduction of Jupiter Jupitar note book is
note book web based interactive
computing platform.
Day 2 Preparing excel sheet Today i created Excel
for analysis related sheet in Ms Excel .
Day 3 Reading excel sheet Read excel sheet
using NumPy and using NumPy and
pandas pandas .
Day 4 Analysis excel sheet Today i analysis 266
cricket players data .
Day 5 Reducing them Minimize the Excel
various functions and sheet using function
variables and variables
Day 6 Plotting the scattered, Plotting scatter using
bar graph using scatter () function
matplotlib
Weekly report 12:
Objectives of daily report:on this day we practice a sample project
Detailed report:we installed Jupiter note book with the help of excel sheet we started data
analysis
Firstly we use library's like numpy ,pandas ,seaborn ,and matplot and then we use pd for reading
excel
sheet (data=PD.read_CSV("loc")
For analysing data.head(), data.tail()
Then we use data.isna(),data.sum(),data.info etc.......
At last for visualizations we can use plt. Scarlet and plt. Show() plt. Bar()& plt. Plt. Show()
LOG BOOK FOR THIRTEEN WEEK:
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Preparation of project Discussed about
project with mentors
and created groups
for project.
Day 2 Topic selection Discussed on the
selection of topic
Day 3 Project name Today me and my
selection group selected
Instagram reach
analysis program for
project
Day 4 Important of It shows the detailed
Instagram reach information about
analysis. views, likes, post in
Instagram
Day 5 Objective of the
project
Day 6 Getting an idea about Today my group is
how to write code going to discussed
about how to
effective code for
project.
LOG BOOK FOR FOURTEENTH WEEK:
Day&Date Brief discussion of Learning outcomes Person incharge
the daily activity sign
Day 1 Importing necessary Import pandas as pd
python libraries and Import NumPy as np
data set. Import matplotlib.
Pyplot as ply
Import seaborn as sns
Data=pd. read_csv(" " )
Day 2 Removing null values Let's drop all these null
and find datatype of values and move further
all columns and datatypes of all the
columns
Day 3 Distribution of The impression i got
impression from from the home section
home on Instagram
Day 4 Distribution of The total number of
impression from times your posts,
Hashtag stories, & promotions
have been viewed. It
does not include profile
views.
Day 5 Distribution of Impressions from
impression from Explore – your post was
Explore viewed from the Explore
page. Impressions from
Other
Day 6 Create hashtag and The only way to lay
analysing relationship claim to a hashtag is to
be the first to use it for
a specific purpose.
Weekly report for 14 week
LOG BOOK FOR FIFTEENTH WEEK:
Day&Date Brief discussion of Learning outcomes Person incharge sign
the daily activity
Day 1 Analysis the conversation rate
conversion rate means how many
followers you are
getting from the
number of profile
visits from a post. T
Day 2 Instagram Reach I will train a machine
prediction model learning model to
predict the reach of
an Instagram post.
Day 3 Analyse the content Now let’s analyze the
content of my
Instagram posts. The
dataset has two
columns, namely
caption and hashtags,
which will help us
understand the kind
of content I post on
Instagram.
Day 4 Analyse reach analyse reach
analysis using analysis using python
python
Day 5 Analyse the here we use different
Instagram using methods to know
different methods reach analysis
Day 6 develope total code finally get information
and run it on about Instagram
computer, Reach Analysis
home = data["From Home"].sum()
hashtags = data["From Hashtags"].sum()
explore = data["From Explore"].sum()
other = data["From Other"].sum()
labels = ['From Home','From Hashtags','From Explore','Other']
values = [home, hashtags, explore, other]
fig = px.pie(data, values=values, names=labels,
title='Impressions on Instagram Posts From Various Sources', hole=0.5)
fig.show()
text = " ".join(i for i in data.Hashtags)
stopwords = set(STOPWORDS)
wordcloud = WordCloud(stopwords=stopwords, background_color="white").generate(text)
plt.figure( figsize=(12,10))
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis("off")
plt.show()
figure = px.scatter(data_frame = data, x="Impressions",
y="Likes", size="Likes", trendline="ols",
title = "Relationship Between Likes and Impressions")
figure.show()
figure = px.scatter(data_frame = data, x="Impressions",
y="Comments", size="Comments", trendline="ols",
title = "Relationship Between Comments and Total Impressions")
figure.show()
figure = px.scatter(data_frame = data, x="Impressions",
y="Shares", size="Shares", trendline="ols",
title = "Relationship Between Shares and Total Impressions")
figure.show()
figure = px.scatter(data_frame = data, x="Impressions",
y="Saves", size="Saves", trendline="ols",
title = "Relationship Between Post Saves and Total Impressions")
figure.show()
correlation = data.corr()
print(correlation["Impressions"].sort_values(ascending=False))
conversion_rate = (data["Follows"].sum() / data["Profile Visits"].sum()) * 100
print(conversion_rate)conversion_rate = (data["Follows"].sum() / data["Profile Visits"].sum()) * 100
print(conversion_rate)
31.17770767613039
figure = px.scatter(data_frame = data, x="Profile Visits",
y="Follows", size="Follows", trendline="ols",
title = "Relationship Between Profile Visits and Followers Gained")
figure.show()
model = PassiveAggressiveRegressor()
model.fit(xtrain, ytrain)
model.score(xtest, ytest)
0.9428392959517574
Conclusion and future enhancement :
CONCLUSION:
I conclude the small effects of screen time on children’s outcomes appear to be moderated by the
type of screen time. Policy makers, educators, and parents should consider the type of screen
time when considering the benefits and harms of use.
Scope for future Development :
This growth is supporting the data analytics industry with a great increase in the amount of data
collected, which can be used to tap into several different sectors in the market. There has already
been a 26.5% year-on-year growth in the data analytics industry in 2021. The market value has
reached US$ 45.4 billion.
Reference :
https://thecleverprogrammer.com/2022/03/22/instagram-rea
ch-analysis-using-python/