Answered step by step
Verified Expert Solution
Link Copied!

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.
sgn(x)={-1,x00,x=01,x>0
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.
(15p) 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 create_sgn_file() that takes a single argument; the name of the
data file. When you call:
create_sgn_file("mydata.csv")
"mydata.csv" file that is stored in the same folder as of your program should be read and "mydata_sgn.csv" 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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

More Books

Students also viewed these Databases questions