0% found this document useful (0 votes)
39 views39 pages

Data Engineering Python Lab Record

The document is a certificate from the University College of Engineering, Osmania University, confirming that a student has completed the Practical Lab Record in Data Engineering with Python Lab for the academic year 2023-24. It includes an index of various programming exercises and projects related to data engineering, such as computing distances, finding GCD, and working with data structures like lists, tuples, and dictionaries. The document also covers database design, file operations, and data manipulation using libraries like Pandas and NumPy.
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)
39 views39 pages

Data Engineering Python Lab Record

The document is a certificate from the University College of Engineering, Osmania University, confirming that a student has completed the Practical Lab Record in Data Engineering with Python Lab for the academic year 2023-24. It includes an index of various programming exercises and projects related to data engineering, such as computing distances, finding GCD, and working with data structures like lists, tuples, and dictionaries. The document also covers database design, file operations, and data manipulation using libraries like Pandas and NumPy.
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

UNIVERSITY COLLEGE OF ENGINEERING

( OSMANIA UNIVERSITY )

CERTIFICATE

This is to certify that Mr. /Miss


is a student of MCA year Semester bearing Hall Ticket
No has done the Practical Lab Record in
Data Engineering with Python Lab during the academic year 2023-24 .

INTERNAL EXAMINAR EXTERNAL EXAMINAR

HEAD OF THE DEPARTMENT


DATA ENGINEERING
WITH PYTHON
LAB RECORD
INDEX
[Link] NAME OF PROGRAM PAGE NO.

1. Program to compute distance between two points taking input from the user. 01

2. Program to find GCD of two numbers. 02

3. Program to find the Factorial of a positive number. 02

4. Program to find Fibonacci series up to n. 02

5. Program to find the product of two matrices. 03

6. Program to take a list as input from the user and use all of its built-in functions. 03

7. Program to take a tuple as input from the user and use all of its built-in 05
functions.

8. Program to take a dictionary as input from the user and use all its built-in functions 06

9. Program to take a set data structure as input from the user and use all of its built- 07
in functions.

10. Using for loop, write a program that prints out the decimal equivalents of 08
½,1/3,1/4…1/10.

11. Program to accept a string as an argument for a function and return the number 09
of vowels and consonants.

12. Program to analyse to text files using set operations. 10

13. Write a program to print each line of a file in reverse order. 11

14. Write a program for reading and writing binary files. 12

15. Write a program for searching, splitting and replacing strings based on pattern 12
matching using regular expressions
16. Design a relational database for a small application and populate the database. 13
Using SQL do the CRUD operations.

17. Program to implement the inheritance. 14

18. Program to implement the polymorphism. 16

19. Write a program in Python to create and combine student and subject data 17
frames in Pandas.

20. Create a Python MongoDB client using Python module pymongo. Using a 18
collection object practice functions for inserting, searching, removing, updating,
replacing, and aggregating documents as well as for creating indexes.

21. Program to create and view a HTML file. 19

22. Program to Take a CSV file as input and extract data from that file. 20

23. Program on data frame and series using Pandas 21

24. Write a Python program on XML and JSON file. 24

25. Program on NumPy library. 26

26. Write a Program to Implement matplotlib. 30

27. Write a Program to implement math functions. 31

28. Write a Program to calculate mean, median, mode. 31

29. Write a Program to implement JSON. 32

30. Write a Program to implement beautiful soup 33

Common questions

Powered by AI

DataFrames and Series in Pandas enable efficient data management and analysis through their robust data structure capabilities. A DataFrame is a two-dimensional labeled data structure with columns of potentially different types, akin to a SQL table or Excel spreadsheet. It allows for operations like data alignment, grouping, merging, reshaping, sorting, and pivots. A Series is a one-dimensional labeled array suitable for holding any data type; it serves as the primary building block for Pandas DataFrames. Both structures provide intuitive indexing, reduce the amount of boilerplate code for data manipulations, and enable complex data transformations and statistical analysis using methods like 'groupby()', 'apply()', and 'merge()', thereby speeding up data processing tasks significantly .

Set operations in Python can be used to compare and analyze text files by treating each file's content as a set of elements. Common operations include union, intersection, difference, and symmetric difference, which can help in identifying unique and common items between files. For instance, to find common words between two files, the intersection of their sets can be computed. Similarly, finding words unique to each file can be done using the difference operation. These operations allow for quick and intuitive analysis of text datasets, making them useful for data deduplication, consistency checks, and data integration tasks .

Designing a relational database for a small application begins with identifying the entities involved and their relationships. For instance, if designing a database for a library system, entities could include 'Books', 'Authors', and 'Members'. Next, determine the attributes for each entity, like 'ISBN' and 'Title' for 'Books'. After the data model is prepared, implement it using tables in a SQL database. Ensure proper normalization to avoid redundancy. CRUD operations involve SQL commands: 'CREATE TABLE' for creating tables, 'INSERT INTO' to add data, 'SELECT' to query data, 'UPDATE' to modify existing data, and 'DELETE' to remove data. Indexes may be created to optimize search operations. In this setup, 'INSERT INTO Books (ISBN, Title) VALUES (...) ', 'SELECT * FROM Books WHERE Title = ...;', 'UPDATE Books SET Title = ... WHERE ISBN = ...;', and 'DELETE FROM Books WHERE ISBN = ...;' are examples of operations within this database .

Regular expressions in Python, available via the 're' module, are versatile tools for pattern matching and data transformation. They enable searching, splitting, and replacing string patterns, facilitating the extraction or manipulation of specific segments of string data. For example, to find all email addresses in a text, a regular expression can be used to match patterns typical of email formats. This is useful in preprocessing and cleaning data, extracting relevant information from unstructured text, and transforming data formats. Regular expressions provide a concise and flexible syntax for processing complex text patterns, making them invaluable for text data manipulation .

Python's file handling capabilities allow for reading from and writing to files on a local machine. This can be done using built-in functions such as 'open()', 'read()', 'write()', and 'close()'. Python also supports handling different file types, including text, binary, CSV, JSON, and XML files. Practical applications in data engineering include reading data from large datasets stored in text files, writing logs, exporting data for backing up or data exchange, and reading configurations. For instance, reading a CSV file to load data into a Pandas DataFrame for further analysis is a common task. Additionally, Python's libraries such as 'os' and 'shutil' are useful for file and directory manipulations, and libraries like 'beautifulsoup' enable parsing HTML files for data extraction purposes .

The BeautifulSoup library in Python is used for web scraping by parsing HTML or XML documents and extracting data from them. It provides Pythonic idioms for iterating, searching, and modifying the parse tree, making it easier to gather data from web pages. To use BeautifulSoup, first, fetch the HTML content using 'requests' or another HTTP library, then parse it with BeautifulSoup by specifying a parser like 'html.parser'. Navigating the parse tree and searching for specific tags or attributes allows users to extract required content. This method is valuable for collecting relevant data from websites for analysis or aggregation tasks in data engineering .

NumPy and Pandas are both essential libraries in Python for performing data engineering tasks. NumPy is mainly used for numerical computations; it provides support for arrays and matrices, along with a collection of mathematical functions to operate on these data structures. Pandas, however, enhances data manipulation and analysis by providing high-level data structures: DataFrames and Series, which allow for easier handling of missing data, creating plots, and reshaping data. While NumPy is suitable for basic mathematical operations and array manipulations, Pandas is more suited for organizing and maneuvering large datasets efficiently .

Python interacts with MongoDB using the PyMongo library, which allows developers to connect to a MongoDB server and perform database operations. The PyMongo API provides functions for inserting, searching, removing, updating, replacing, and aggregating documents, as well as creating indexes. MongoDB is advantageous for data storage due to its schema-less nature, which allows for flexibility and scalability in storing hierarchical data. It supports high write loads and can handle large volumes of unstructured data efficiently. These features make MongoDB suitable for applications that require large data storage, rapid prototyping, and agile development methods .

The NumPy library provides significant computational benefits for handling mathematical functions in Python by offering powerful n-dimensional array objects and a suite of functions for performing various mathematical operations. NumPy arrays occupy less memory and deliver faster performance compared to Python lists due to their fixed size and efficient item access. Operations on entire arrays can be executed with a syntax close to the mathematical language, leading to cleaner and more understandable code. NumPy is optimized for performance using sophisticated algorithms and can leverage multi-dimensional data structures, which are essential for scientific computations, statistics, and machine learning applications .

Python implements inheritance and polymorphism through classes and objects. Inheritance allows a class (child class) to inherit attributes and methods from another class (parent class). This can be done by defining the child class with the parent class in the class definition using the syntax 'class ChildClass(ParentClass)'. Polymorphism allows for using a unified interface to interact with different underlying forms (data types or classes). It is implemented in Python by defining methods in the child class with the same name as methods in the parent class. This enables method overriding, where the method in a child class takes precedence over the method in the parent class when called on a child class instance. In practice, this means if an object of the child class calls the method, the overridden method in the child class is executed .

You might also like