anuj
anuj
DATA SCIENCE
LAB RECORD
B.TECH
III YEAR/I SEM Reg NO:___________________
NAME:____________________
B V RAJU INSTITUTE OF TECHNOLOGY
( UGC - Autonomous )
Vishnupur, Narsapur, Medak Dist – 502313
UNIVERSAL LEARNING
CERTIFICATE
This is to certify that this is the bonafide work of
Reg.No.
the laboratory
Week-1
Lists, Tuples and Dictionaries
1. Create a list containing the numbers from 1 to 10. Remove the number
5, reverse the list, and then sort it.
Output:
Output:
3. Given the tuple `my_tuple = (10, 20, 30)`, unpack the elements into
variables `a`, `b`, and `c` and print them.
Output:
4. Create a dictionary where the keys are numbers from 1 to 5 and the
values are their cubes.
Output:
5. Create a nested list `nested_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]`. Extract
and print the element at the second row and third column.
Output:
Output:
7. Given the dictionary `sample_dict = {‘a’: 1,’b’: 2,’c’: 3}, use the `get()`
method to print the value for key ‘d’ with a default message ‘Not Found’.
Output:
8. Create a named tuple `Car` with fields `make`, `model`, and `year`. Create
an instance of `Car` and print its fields.
Output:
Week-2
1. Read the CSV file students.csv into a pandas DataFrame, filter students
with score greater than 80, and save the filtered data to a new CSV file
filtered_students.csv.
Output:
2. Read the text file input.txt, count the number of lines, and write the
count to a new text file line_count.txt.
Output:
3. Read the JSON file products.json, add a new product to the list, and
save the update list back to the JSON file.
Output:
Output:
5. Read a JSON file from a web URL into a pandas DataFrame and display
the first five rows.
Output:
Week-3
1. Create a DataFrame with sample data, save it in CSV, TXT, and JSON
formats, then read it back and describe the procedure.
Output:
2. Plot histograms for the Age and Salary columns from the sample
DataFrame and describe the distribution.
Output:
Week-3
Output:
5. Plot histograms for the Price and Stock columns from the sample
DataFrame and describe the distribution.
Output:
Output:
Output:
8. Plot a histogram for the Discount column from the sample DataFrame
and describe the distribution.
Output:
Output:
Week-4
1. Using the sample data provided, create a bar plot with error bars, add
text labels above each bar, and customize the appearance of the plot.
Sample Data:
• Categories: [X, Y, Z, W]
• Values: [20, 35, 30, 25]
• Errors: [2, 3, 2.5, 1.5]
Output:
2. Modify the bar plot to display horizontal bars with error bars, add text
labels at the end of each bar, and customize the appearance of the plot.
Sample Data:
• Categories: [P, Q, R, S]
• Values: [40, 25, 50, 30]
• Errors: [4, 2.5, 5, 3]
Output:
3. Create a stacked bar plot with error bars for two sets of values, add text
labels above each bar, and customize the appearance of the plot.
Sample Data:
• Categories: [A1, B1, C1, D1]
• Values1: [10, 20, 15, 25]
• Errors1: [1, 2, 1.5, 2]
• Values2: [5, 15, 10, 20]
• Errors2: [0.5, 1.5, 1, 1.5]
Output:
Output:
Output:
6. Create a pie chart with a custom start angle, customize the appearance
with different colors and explode values, and add annotations.
Sample Data:
• Labels: [Group A, Group B, Group C, Group D]
• Sizes: [30, 25, 25, 20]
• Colors: [gold, yellowgreen, lightcoral, lightskyblue]
• Explode: (0, 0.1, 0, 0.1)
Output:
7. Create a box plot for multiple categories, highlight the outliers with a
different color, and add annotations for the median values.
Sample Data:
• Categories: [Cat1, Cat2, Cat3]
• Data: Randomly generated normal data with different standard
deviations
Output:
Week-5
1. Calculate the mean, median, mode, standard deviation, and variance for
a dataset of 100 randomly generated integers between 1 and 100.
Output:
Output:
Output:
Output:
Output:
Output:
7. Calculate 95% confidence intervals for the mean height of students and
visualize them with a bar plot.
Output:
Output:
Output:
10. Upload a text file, preprocess the text, and create a bar plot of the top 10
most common words.
Output:
11. Upload an image file, convert it to grayscale, and calculate the mean,
median, and mode of pixel intensities. Also, plot the histogram of pixel
intensities.
Data Science
Computer Lab and Operating Systems
Networks DATE: _ _ /_ _ /_ _
Output:
Data Science
Computer Lab and Operating Systems
Networks DATE: _ _ /_ _ /_ _
Output:
Week 6
Output:
2. Fetch historical data for multiple stock symbols, calculate the correlation
matrix, and visualize it using a heatmap.
Output:
Output:
Output:
5. Visualize the trends of stock prices along with moving averages over a
specified period.
Output:
6. Analyze and visualize the volatility of a stock using its rolling standard
deviation over a specified period.
Output:
7. Create an interactive line plot for stock prices with Plotly to allow
zooming and hovering features.
Output:
Week 7
Output:
Output:
Output:
Output:
Output:
Output:
Week 8
Week 9
Output:
Week 10
Output:
Week 11
Output:
Week 12
Output:
Week 13
Output:
Week 14
Output: