Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In mathematics, sign function ( or signum function ) is a function that returns the sign of a real number. In mathematical notation the sign
In mathematics, sign function or signum function is a function that returns the sign of a real number. In
mathematical notation the sign function is often represented as sgn
Now suppose we have a matrix stored in a csv file as in the following example. When we apply the signum
function to each cell of the matrix, we create another matrix that is called a signum matrix.
p Write a Python program in a single script file that reads such a matrix from a "data.csv file and creates
another file named "datasgn.csv in the same folder which contains the associated signum matrix. In your
program, you should create a function called createsgnfile that takes a single argument; the name of the
data file. When you call:
createsgnfilemydatacsv
"mydata.csv file that is stored in the same folder as of your program should be read and "mydatasgncsv file
should automatically be created in the same folder. In the function body, you should be using tools provided by
"Pandas" package. You can test your program using the "mydata.csv file given with this homework assignment.
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