
Mia J.
asked 12/09/19Need help writing python code to look at 3 things from an excel data file.
I need help with writing some codes for my project using Python. This is a very intro level class as I am an english major but took this class as interested in biostats (micro is my minor). We are allowed any and all outside help including our notes! I have an excel file that I've uploaded and most of my codes I think will be from Scipy and pandas which were quickly and superficially covered. Please help me write the code and analyze 2 or 3 things I want to look at from my csv file! This should be very simple if I'm getting tutored by a Python expert or someone with experience according to my professor. So I'm thinking around 30 mins max, however this is my first time, so a step-by-step guidance would be nice possible. Thank you! Please let me know!
1 Expert Answer
William M. answered 12/15/19
STEM Tutor (Ph.D, Northwestern) | Algebra–Calc, Bio, Chem, Physics, CS
I assume you can use pandas to read and write your .csv file, which makes your life much easier.
You can then do something like this:
(data is made up; your actual data will vary, the way you can use pandas depends on your data)
famous.csv
LName, FName, GPA, ID, DOB
Bond, James, 3.90, 007, 1980
Einstein, Albert, 3.00, 671, 1879
Washington, George, 3.25, 001, 1732
Shakespeare, William, 3.75, 245, 1564
python3 # on a macOs --- on Windows or Linux, just type python
>>>import pandas
>>>data_frame = pandas.read_csv("famous.csv")
>>>print(data_frame)
LName FName. GPA ID DOB
0 Bond James 3.90 7 1980
1 Einstein Albert 3.00 671 1879
2 Washington George 3.25 1 1732
3 Shakespeare William 3.75 245 1564
>>>
Hope that helps!
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Christopher A.
Mia, we don't have the csv file, but the basics of reading a csv in python are not too difficult. Since you want to analyze the data, I would suggest using the pandas module. First, import pandas and then use the pandas.read_csv() method to bring your data into a dataframe object. The dataframe will allow you to calculate statistics about your data. Hope that helps. Feel free to ask more questions.12/10/19