Question
This is a python question. In the following code cell, write a function called convert() that takes a string, filename, and an int, column that
This is a python question.
In the following code cell, write a function called convert() that takes a string, filename, and an int, column that is the column number that contains the values that require conversion from string to float and returns col_values, the list of values contained in the column as float values.
Two conditions:
Make sure to strip the newline character at the end of the line.
From the description of examples above, observe the utility of next() or slicing in order to skip the header.
def convert(filename, column): ''' converts a column in a file with floating point values from string to a list of float values. ''' col_values = [] #code here;;;;; there is a file called test_file, which is just a big big data of texts.
with open(test_file,'r') as filename:
return col_values
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