Update page 'Day 1 homework'
@@ -23,7 +23,6 @@ df['Product'] = df['Number1'] * df['Number2']
|
||||
|
||||
print(df)
|
||||
```
|
||||
|
||||
5. You can use `sys.getsizeof` to see how large a Python object is. Does the size of a Python floating-point number change as it gets larger? Why or why not?
|
||||
6. We already know that the precision of floating-point numbers decreases as their magnitude increases. Using Pandas, create a dataframe representing a large amount of US Dollars. What is the smallest number of dollars where adding one cent begins to yield wrong results?
|
||||
7. Name three practical differences between Python strings and bytes. Using `sys.getsizeof`, see how the sizes may be different. Do emoji change this answer?
|
||||
@@ -50,7 +49,5 @@ read_tomato_sales("tomato_sales_error.csv")
|
||||
```
|
||||
|
||||
describe a hypothetical situation where modifying the CSV file to create a type confusion error could cause nuclear war due to AIs taking over the food supply chain.
|
||||
|
||||
9. Prevent that nuclear war by modifying `read_tomato_sales` to perform better data validation.
|
||||
|
||||
10. Given today's conversation about character encodings, describe why you would want to use bytes instead of strings when processing data containing multiple human languages at the same time. Write a small Python function to demonstrate this.
|
||||
|
||||
Reference in New Issue
Block a user