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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!