Question
ON PYTHON Using pandas to read txt file Create dataframe, and then series for mag column Use series method to generate descriptive statistics of earthquake
ON PYTHON
Using pandas to read txt file Create dataframe, and then series for mag column Use series method to generate descriptive statistics of earthquake mag., i.e. min, max, mean, median, std
ThE txt file, called "earthquake.txt" contains event information about earthquakes with magnitude >=4.5 During 10/03/2019~11/01/2019 Adapted from usgs.gov Each line: an individual earthquake Contains time, latitude, longitude, depth, magnitude in order (separated by whitespace)
#Using pandas for importing and statistics reporting. visual check on symmetry and normality data=pd.read_csv('earthquake.txt', delimiter="\t")
# if the file already contains column names in the first row, the next code line is not needed data.columns=['time','latitude','longitude','depth','mag']
#check out whether column names are correctly recorded print (data.columns.values)
# check out first five lines print (data.head()) # get an overview of data set print (data.info())
#size of your data print (data.shape) #get series of mag magdata=data['mag']
# report descriptive statistics print ('the median is', magdata.median())
#same for mi max std etc. data_median=magdata.median() print (magdata.describe())
# whole list of descriptive stats.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started