Write an Earthquake class that demonstrates the following aspects of OOP in Python:
1. Create a basic class that can hold all relevant earthquake data saved in index.sqlite see below
2. Appropriately create a constructor to set all data values .
3. Create a regular class method that returns all or part of the Earthquake data as a dictionary object.
4. Override the __str__ method to print a reasonable string representation of an Earthquake.
5. Use the @property decorator to make at least one property in your Earthquake class private.
6. Use the @???.setter method to validate the private property in some way (e.g. check if its numeric, change it's data type, change it's length...) before setting its value.
Write a second class called Point, Position or Time to store one or more pieces of earthquake data.This class can be included in the Earthquake.py file.
· The class could store latitude & longitude OR latitude and longitude and depth OR timestamp
· You should use this class in the Earthquake class instead of storing the vales as primitive data types
· This class should include an __init__ method and a __str__ method. If you create class to stor time, the __str__ method should return a formatted string, not a timestamp.
You may use the Author and Article classes presented in lecture as a starting point for these classes.
Write an Earthquake_stats class that uses the Earthquake object AND a Pandas dataframe to process earthquake data and display basic statistics.
· You should import the Earthquake module to use in this application.
· You will read Earthquakes from the database, just like in stats.py, but instead of putting them into individual lists for each type of date, you will create a list of Earthquake objects.
· You will list of earthquake objects to a Panda's Dataframe.
o See https://stackoverflow.com/questions/47623014/converting-a-list-of-objects-to-a-pandas-dataframe for an example of how to use a custom method to turn you object into a dictionary AND use list comprehension to create a list of Earthquake dictionaries to create your DataFrame.
· Display either the first 5 or last 5 earthquakes in the dataframe to the screen.
· Use the dataframe to compute basic statistics for the entire population of earthquakes
· Compute the same basic statistics for earthquakes filtered on Region. Computer a separate set of statistics for two different regions that have at least 200 earthquakes in your sample.
Compute the same basic
statistics for all earthquakes filtered by either felt, tsunami or depth
e.g felt > 0, tsunami > 0, depth < 50 or depth<100.