0% found this document useful (0 votes)
8 views

12th Group Project Ip

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)
8 views

12th Group Project Ip

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/ 32

CLASS 12th INFORMATION PRACTICES(065)

INTRODUCTION TO PYTHON
Python is a widely used general-purpose interpreted, object-oriented, high-level
programming language with dynamic semantics. Its high-level built in data
structures, combined with dynamic typing and dynamic binding, make it very
attractive for Rapid Application Development, as well as for use as a scripting or
glue language to connect existing components together.
Python's simple, easy to learn syntax emphasizes readability and therefore reduces
the cost of program maintenance. Python supports modules and packages, which
encourages program modularity and code reuse. The Python interpreter and the
extensive standard library are available in source or binary form without charge for
all major platforms, and can be freely distributed.
Python was created by Guido van Rossum in 1991 and further developed by the
Python Software Foundation. It was designed with an emphasis on code
readability, and its syntax allows programmers to express their concepts in fewer
lines of code.
Python is a programming language that lets you work quickly and integrate
systems more efficiently.
It is used for:
• web development (server-side),
• software development,
• mathematics, • system scripting.

Keshav choudhary
Page 1
CLASS 12th INFORMATION PRACTICES(065)

HISTORY OF PYTHON
In the late 1980s, history was about to be written. It was that time when working on
Python started. Soon after that, Guido Van Rossum began doing its
applicationbased work in December of 1989 at Centrum Wiskunde & Informatica
(CWI) which is situated in the Netherlands. It was started as a hobby project
because he was looking for an interesting project to keep him occupied during
Christmas.

The programming language in which Python is said to have succeeded is ABC


Programming Language, which had interfacing with the Amoeba Operating
System and had the feature of exception handling. He had already helped create
ABC earlier in his career and had seen some issues with ABC but liked most of the
features. After that what he did was very clever. He had taken the syntax of ABC,
and some of its good features. It came with a lot of complaints too, so he fixed
those issues completely and created a good scripting language that had removed all
the flaws.

The inspiration for the name came from the BBC’s TV Show – ‘Monty Python’s
Flying Circus’, as he was a big fan of the TV show and also he wanted a short,
unique and slightly mysterious name for his invention and hence he named it
Python! He was the “Benevolent dictator for life” (BDFL) until he stepped down
from the position as the leader on 12th July 2018. For quite some time he used to
work for Google, but currently, he is working at Dropbox.

Keshav choudhary
Page 2
CLASS 12th INFORMATION PRACTICES(065)

FEATURES OF PYTHON
• Python is an interpreted, interactive, directly executed language with a
precompiled code.
• It is a loosely typed object-oriented programming language with few
keywords, simple English-like structure and easy to learn.
• It is a free, open-source and portable language having a large repository of
libraries.
• It takes less time to develop as python programs are typically 3 to 5 times
shorter than the equivalent programming languages. This is because of its
builtin, high level data types and its dynamic typing.
• It is extensible/ extendable and highly efficient as there is no wastage of time
in declaring the types of variable or arguments.
• It supports GUI (graphical user interface) and garbage collection.
• It is easily compatible with other languages like C, C++, core java, etc.
• Python is used for both scientific and non-scientific programming.

Keshav choudhary
Page 3
CLASS 12th INFORMATION PRACTICES(065)

ADVANTAGES OF PYTHON

1. Platform-independent: It is platform independent and can run across


different platforms like Windows, linux/unix, Mac OS and other operating
systems. Thus, we can say that python is a portable language.
2. Readability: Python programs use clear, simple, concise and english-like
instructions that are easy to read and understand even by non-programmers
or people with no substantial programming background.
3. Higher productivity: Since python is a simple language with small codes and
extensive libraries, it offers higher productivity to programmers as compared
to languages like c++ and java. So, you write less and get more done.
4. GUI programming: Python supports GUI applications that can be created
and ported to many system calls, libraries and windows systems such as
windows MFC (microsoft foundation class library), macintosh and the X
window system of unix.
5. Ample availablity of libraries: It provides large standard libraries to solve a
task.

Keshav choudhary
Page 4
CLASS 12th INFORMATION PRACTICES(065)

DISADVANTAGES OF PYTHON

1. Speed: Python is slower than C or C++. But Python, of course, is a high


level language and unlike C or C++, it is not closer to hardware.
2. Mobile Development: Python is not considered very good for mobile
development. It is seen as a weak language for mobile development.
3. Memory Consumption: Python is not a good choice for memory intensive
tasks. Due to the flexibility of datatypes, Python’s memory consumption is
also high.
4. Database Access: Python has its limitations with database access. Python’s
database access layer is found to be a bit underdeveloped and primitive.
However, it cannot be applied in the enterprises that need smooth interaction
of complex legacy data.
5. Runtime Errors: Python programmers have cited several issues with the
design of the language. Since the language is dynamically typed, it requires
more testing and has errors that only show up at run-time.

Keshav choudhary
Page 5
CLASS 12th INFORMATION PRACTICES(065)

INTRODUCTION TO PANDAS
Pandas is a powerful Python library for data analysis and manipulation. It is
widely used for working with structured data, such as tables, spreadsheets, or
databases.

HISTORY OF PANDAS

Pandas is a Python library used for working with data. Its development is a story
of solving real-world problems with better tools for data analysis.

TIMELINE:

- 2008: Wes McKinney started creating Pandas because existing tools


weren’t meeting his needs for analyzing financial data efficiently.

- 2009: The first version of Pandas was released. The name “PANDAS”
comes from “PANEL DATA SYSTEM” which refers to multi-dimensional data
used in statistics.

- 2010s: Pandas quickly gained popularity among data scientists and analysts
for its powerful and flexible data handling capabilities. It became a key tool in the
Python data science ecosystem.

- 2015 and Beyond: Pandas continued to grow with frequent updates, adding
new features and improvements. It remains a core library for data analysis in
Python today.

Pandas has evolved from a personal project into one of the most important tools for
working with data in Python.

Keshav choudhary
Page 6
CLASS 12th INFORMATION PRACTICES(065)

KEY FEATURES OF PANDAS:

1. DATA STRUCTURES:
- Series: Think of it as a single column of data with labels.
- DataFrame: Imagine a table with rows and columns, like a spreadsheet.

2. MAIN USES:
- Data Cleaning: Fix issues like missing values and incorrect data types.
- Data Transformation: Reshape or combine data to fit your needs.
- Data Analysis: Summarize and analyze data to find insights.

3. FILE HANDLING:
- Read and Write: Easily read data from files and save your results to files.

4. TIME SERIES:
- Dates and Times: Handle and analyze time-based data efficiently.

Pandas simplifies many tasks involved in working with data, making it easier to
clean, analyze, and visualize information.

Keshav choudhary
Page 7
CLASS 12th INFORMATION PRACTICES(065)

\
INTRODUCTION TO MATPLOTLIB
Matplotlib is a widely-used Python library for creating static, animated, and
interactive visualizations in Python. It provides a comprehensive toolkit for
generating a variety of plots and graphs, which makes it a valuable resource for
data analysis, scientific research, and engineering applications.

KEY FEATURES OF MATPLOTLIB


1. Versatility: Matplotlib can create a range of visualizations, including line
plots, scatter plots, bar charts, histograms, and 3D plots. Its flexibility allows you
to customize plots in numerous ways.

2. Integration: It integrates well with other Python libraries such as NumPy,


Pandas, and SciPy, making it easier to visualize data from various sources and
formats.

3. Customizability: You can extensively customize plots in Matplotlib, from


adjusting colors and styles to modifying axis labels and adding annotations.

4. Interactive Plots: It supports interactive plots and widgets, which can be


used in Jupyter notebooks and other environments to create more engaging and
dynamic visualizations.

Keshav choudhary
Page 8
CLASS 12th INFORMATION PRACTICES(065)

5. Publication-Quality Output: Matplotlib can generate high-quality graphics


suitable for publication, with support for various formats like PNG, PDF, SVG,
and EPS.

BASIC CONCEPTS OF MATPLOTLIB


1. Figure and Axes: The basic building blocks in Matplotlib are the `Figure`
and `Axes` objects. A `Figure` is the overall window or page, and `Axes` are the
individual plots or subplots within the figure. You can think of a `Figure` as a
canvas, and `Axes` as the plots on that canvas.

2. Plotting Functions: Matplotlib provides various functions to create plots.


For example, `plt.plot()` is used for line plots, while `plt.scatter()` is used for
scatter plots.

3. Customization: After creating a plot, you can customize it using methods


and functions, such as `set_title()`, `set_xlabel()`, and `set_ylabel()` for setting
titles and labels, or using `plt.legend()` to add a legend.
Matplotlib is a powerful tool with a rich set of features, making it a go-to library
for data visualization in Python.

Keshav choudhary
Page 9
CLASS
12th
INFORMATION PRACTICES(065)

About Netflix
Netflix is a global streaming platform that offers a wide variety of television shows, movies,
documentaries, and original content. Founded in 1997 by Reed Hastings and Marc Randolph, Netflix
initially operated as a DVD rental service before transitioning to streaming in 2007. Today, it boasts over
230 million subscribers in more than 190 countries.

Netflix is renowned for its original programming, including critically acclaimed series like "Stranger
Things," "The Crown," and "House of Cards," as well as a growing library of films and documentaries. The
platform invests heavily in content creation, spending billions annually to produce and acquire new titles.

Its user-friendly interface allows subscribers to easily browse and discover content tailored to their
preferences, often using sophisticated algorithms to recommend shows and movies. Netflix has also
ventured into interactive content and gaming, expanding its reach in the entertainment industry.

As a pioneer in the streaming revolution, Netflix has significantly influenced how audiences consume
media, shifting the industry from traditional cable to on-demand streaming. The platform continues to
evolve, adapting to changing viewer habits and technological advancements.

About Netflix
Netflix is a global streaming platform that offers a wide variety of television shows, movies,
documentaries, and original content. Founded in 1997 by Reed Hastings and Marc Randolph, Netflix
CLASS
12th
INFORMATION PRACTICES(065)

initially operated as a DVD rental service before transitioning to streaming in 2007. Today, it boasts over
230 million subscribers in more than 190 countries.

Netflix is renowned for its original programming, including critically acclaimed series like "Stranger
Things," "The Crown," and "House of Cards," as well as a growing library of films and documentaries. The
platform invests heavily in content creation, spending billions annually to produce and acquire new titles.

Its user-friendly interface allows subscribers to easily browse and discover content tailored to their
preferences, often using sophisticated algorithms to recommend shows and movies. Netflix has also
ventured into interactive content and gaming, expanding its reach in the entertainment industry.

As a pioneer in the streaming revolution, Netflix has significantly influenced how audiences consume
media, shifting the industry from traditional cable to on-demand streaming. The platform continues to
evolve, adapting to changing viewer habits and technological advancements.
CLASS
12th
INFORMATION PRACTICES(065)

FUNCTIONS USED

1. Python built-in functions:


- `print()`: Outputs text or data to the console.
- `input()`: Reads input from the user.

2. Pandas library functions:


- `pd.read_csv()`: Reads data from a CSV file into a DataFrame.
- `pd.DataFrame()`: Creates a DataFrame from data.
- `df.loc[]`: Selects data by labels or conditions.
- `df.head()`: Retrieves the first few rows of a Data Frame.
- `df.tail()`: Retrieves the last few rows of a DataFrame.
- `df.sort_values()`: Sorts data in the DataFrame by specified columns. - `df.plot()`: Plots
data from a DataFrame.

3. Matplotlib library functions:


- `plt.ylabel()`: Sets the label for the y-axis of a plot.
- `plt.title()`: Sets the title of a plot.
- `plt.show()`: Displays the plot.
- `plt.plot()`: Creates a line plot of data.
- `plt.bar()`: Creates a bar plot.
- `plt.hist()`: Creates a histogram.
- `plt.scatter()`: Creates a scatter plot.

4. Control flow statements:


CLASS
12th
INFORMATION PRACTICES(065)

- `if`, `elif`, `else`: Execute different blocks of code based on conditions.


- `while True`: Creates an infinite loop that continues until explicitly broken.

Netflix Data Analysis Project


CLASS
12th
INFORMATION PRACTICES(065)

SOURCE CODE
import pandas as pd import

matplotlib.pyplot as pl ch='Y'

while ch=='Y':

print('1.read csv file') print('2.show all

records') print('3.show the name of DRAMA

series') print('4.search record') print('5.add

new record') print('6.delete record')

print('7.modify record') print('8.show

Rating chart using line graph') print('9.show

Rating chart using bar graph') print('10.save

data into csv file') choice=int(input('enter

your choice:')) if choice==1:

df = pd.read_csv('netflix.csv')#read the csv file

print('file opened') elif choice==2:

print (df) elif

choice==3:

print(df[df['category']=='Drama']['Series_n'])

elif choice==4:

e=int(input('enter NETFLIX ID you want to search')) inx=df[df.NID==e].index.values # to get index value if

len(inx)==0:

print("record not found")

else:

print(df[df.NID==e])

elif choice==5:
CLASS
12th
INFORMATION PRACTICES(065)

nid=int(input('enter netflix id'))

s=input('enter the name of the series')

dor=input('enter the date of release')

noe=int(input('enter the NOE'))

sea=int(input('enter the seasons'))

dn=input('enter the director name')

an=input('enter the actor name')

acn=input('enter the actoress name')

c=input('enter the category')

r=int(input("Enter the Rating"))

df=df.append({'NID':nid,'Series_n':s,'DOR':dor,'NOE':noe,'Seasons':sea,"Director_n":dn,"Actor":an,"Acto
ress":acn,"category":c,"Rating":r},ignore_index=True) elif choice==6:

e=int(input('enter Netflix ID to delete'))

inx=df[df.NID==e].index.values if

len(inx)==0:

print('record not found')

else:

print(df[df.NID==e])

df=df[df['NID']!=e]

print('record deleted')

df.index=range(len(df))

#rearrange index no elif

choice==7:
CLASS
12th
INFORMATION PRACTICES(065)

e=int(input('enter NETFLIX ID to modify'))

inx=df[df.NID==e].index.values #to get index value if

len(inx)==0:

print("record not found")

else:

print(df[df.NID==e]) s=input('enter the new name

of the series') dor=input('enter the new date of

release') noe=int(input('enter the new number of

episodes')) sea=int(input('enter the updated

seasons')) dn=input('enter the new director name')

an=input('enter the new actor name')

acn=input('enter the new actoress name')

c=input('enter the new category')

r=int(input("Enter the new Rating"))

df.loc[inx,"Series_n"]=n df.loc[inx,"DOR"]=dor

df.loc[inx,"NOE"]=noe df.loc[inx,"Seasons"]=sea

df.loc[inx,"Director_n"]=dn df.loc[inx,"Actor"]=an

df.loc[inx,"Actoress"]=acn

df.loc[inx,"category"]=c

df.loc[inx,"Rating"]=r

print("record updated") elif

choice==8: pl.ylabel('Rating')

pl.xlabel('NID')

pl.plot(df['NID'],df['Rating'])
CLASS
12th
INFORMATION PRACTICES(065)

pl.title('Rating chart')

pl.show() elif choice==9:

pl.bar(df['Series_n'],df['NOE'])

pl.title('Number of Episode graph')

pl.xlabel('Series name') pl.show() elif

choice==10:

df.to_csv('netflix.csv',index=False)

print('file saved') ch=input(' do u want to

continue ').upper()

Screenshots of code:
CLASS
12th
INFORMATION PRACTICES(065)

Choice 1:

Choice 2:
CLASS
12th
INFORMATION PRACTICES(065)

Choice 3:
CLASS
12th
INFORMATION PRACTICES(065)

Choice 4:
CLASS
12th
INFORMATION PRACTICES(065)
CLASS
12th
INFORMATION PRACTICES(065)

Choice 5:
CLASS
12th
INFORMATION PRACTICES(065)

After changes:
CLASS
12th
INFORMATION PRACTICES(065)

Choice 6:

After changes:
CLASS
12th
INFORMATION PRACTICES(065)
CLASS
12th
INFORMATION PRACTICES(065)

Choice 7:
CLASS
12th
INFORMATION PRACTICES(065)

After changes:

Choice 8:
CLASS
12th
INFORMATION PRACTICES(065)

Choice 9:
CLASS
12th
INFORMATION PRACTICES(065)
CLASS
12th
INFORMATION PRACTICES(065)

Choice 10:
CLASS
12th
INFORMATION PRACTICES(065)

Conclusion
This is a Python program that utilizes the Pandas library for data manipulation and
Matplotlib for data visualization. It offers a command-line interface for users to
interact with a dataset of Netflix series stored in a CSV file. The program enables users
to perform various operations, including reading the CSV file, displaying records,
filtering for drama series, searching for records by Netflix ID, and adding, deleting, or
modifying existing records. Additionally, it provides the capability to visualize data
through line and bar graphs, illustrating ratings and the number of episodes,
respectively.

The program operates in a loop, allowing users to execute multiple operations until
they choose to exit. Each choice corresponds to a different function, enhancing user
interaction and data management capabilities. Furthermore, the code ensures that
the dataset is saved back to the CSV file after modifications, preserving changes
made during the session.

In conclusion, this code represents a comprehensive tool for managing and


analyzing a Netflix series dataset. Its functionalities cover essential data operations
and visualizations, making it suitable for users interested in exploring and
modifying the dataset efficiently. The program's structured approach to user input
and error handling (e.g., checking for record existence) enhances usability, while its
integration with visual plotting libraries enriches the data presentation. Overall, it
serves as a practical application for individuals looking to manage entertainment
data effectively.
CLASS
12th
INFORMATION PRACTICES(065)

BIBLIOGRAPHY
ww.w.cbseacadmeic.nic.in

www.epython.org www.thonny.org

You might also like