Here is the Period 1 Libraries HW. It will be due Wednesday night, at 11:59 PM. 1. 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 Problem 1
API I learned about was the OPENAI api, which you can submit a text-content request as an assistant chat-bot or as a normal user. With this you will be able to make chatbots on your personal website that can assist a user. For example, in a website that sells merch you can add the chatgpt bot that can assist the user if they have trouble with something such as quality of the merch material.
# Problem 2
import pandas as pd
# Create a sample DataFrame
people = {'Name': ['John', 'Jacob', 'Johnny'],
'Age': [25, 30, 22],
'City': ['New York', 'Los Angeles', 'Chicago']}
df = pd.DataFrame(people)
print("Original not modified dataframe",df) # Here is my original dataframe
df['Is_Adult'] = df['Age'] >= 18 # adding a row that tells wether the person is older than 18 or is an adult
print(len(df['Is_Adult'], ' is the amount of adults')) # printing out the new row length showing adults in the dataframe
Libraries Notes:
Python libraries offer pre-written code, functions, and modules for extending Python’s capabilities. They simplify and speed up development.
Importing Libraries: Libraries are imported using the import statement which is apart of python. Specific functions can be imported using from. We can use it to make stuff shorter, more effecient, and possibly faster. Documentation:
Libraries come with documentation for usage guidance and code examples on the library website or company website.