Question: Python help! I need help with these questions! i included a screen shot of the data and what i have done for the project so
Python help! I need help with these questions! i included a screen shot of the data and what i have done for the project so far. The explanation of the data is also below!
8. output all the above answers to the result.txt file
The file should look like:
Results of analysis:
How many materials the data has:xxx
How many missing values the data has:xxx
9. plot the XRD data of the material named AlNi5(missing value can be regarded as 0).Use plt.savefig() function
Each line shows the XRD data of all the materials given a specific Intensity (Arb. Units). AlNi* are the name of the materials. Each column shows the XRD data of one material.Write the python code to get the answer of following tasks. Use python code to directly write the result to a file called result.txt. And save the plot to figure.png. 


from math import file-open("4material.csv", "r") lines-file. readlines) # print (lines) attributes-lines [0].strip().split(",") mapA2Index-th index-0 for x in attributes [1:]: mapA2Index [x.strip()]-index index+-1 spacecount-0 for line in lines L materials-line.strip().split(',') for data in materiaLSIL: check-data.strip() if check.isspace): spacecount++1 elif len (check.split))0 spacecount++1 intensitycount-0 for line in lines [1: intensitycount+1 zerocount-0 for line in lines [1 materials-line.strip().split(',') for data in materials [1:1: check-data.strip() if check "": zerocount+-1 totalintensity-0 forline in lines [1:1: materials-Line, strip ( ) . split(') totalintensityt-float(materials [0]) averageintensity-totalintensity/len (lines [1:]) from math import file-open("4material.csv", "r") lines-file. readlines) # print (lines) attributes-lines [0].strip().split(",") mapA2Index-th index-0 for x in attributes [1:]: mapA2Index [x.strip()]-index index+-1 spacecount-0 for line in lines L materials-line.strip().split(',') for data in materiaLSIL: check-data.strip() if check.isspace): spacecount++1 elif len (check.split))0 spacecount++1 intensitycount-0 for line in lines [1: intensitycount+1 zerocount-0 for line in lines [1 materials-line.strip().split(',') for data in materials [1:1: check-data.strip() if check "": zerocount+-1 totalintensity-0 forline in lines [1:1: materials-Line, strip ( ) . split(') totalintensityt-float(materials [0]) averageintensity-totalintensity/len (lines [1:])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
