- Research 3 different libraries in python. Explain their purpose as well as two of your favorite variables/functions in each. Type out your response.
- Research an API. What is something unique about it that you learned in the documentation? What type of an API is it? What does it do? Brainstorm a potential scenario. Type out your response.
- Import a data manipulation library and use a prefixed function and prefixed variable (w/comments).
HW HACK 1
Library 1: Pandas
Pandas is a popular Python library for data manipulation and analysis. It provides easy-to-use data structures and data analysis tools for working with structured data, such as tables, spreadsheets, and time-series data.
My favorite functions in Pandas are groupby() to split up data and pivot_table() to transform it and reshape it.
Library 2: Random
Random is a great and simple python library for getting random numbers or outputs. Two of my favorite functions are random.random() or random.shuffle().
Library 3: Flask
Flask is a library we’re using currently to host backend python servers. Two of my favorite functions are @app.route(‘/api/data’), and return render_template(‘index.html’).
HW HACK 2
Google Maps Javascript API
The Google Maps API allows developers to embed interactive and customizable Google Maps into web applications. Something unique I learned from the documentation was that you can customize the map sytles, with custom icons and color schemes to fit your website. Its a web-mapping API with a wide range of features. I could use it to develop a geoguessr game or make software for a scheduling app that gives you in-house directions to meetings.
HW HACK 3
# Import NumPy library with alias 'np'
import numpy as np
# Create two NumPy arrays
array1 = np.array([1, 2, 3, 4, 5])
array2 = np.array([6, 7, 8, 9, 10])
# Perform element-wise addition
result = array1 + array2
# Calculate the mean of resulting array
mean = np.mean(result)
# Print result and mean
print("Result of element-wise addition:", result)
print("Mean of the result:", mean)
Result of element-wise addition: [ 7 9 11 13 15]
Mean of the result: 11.0