{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"ds-1000","formal_name":"DS-1000","introduction":"DS-1000 builds 1,000 data-science problems from real StackOverflow questions across seven libraries including NumPy, Pandas and Matplotlib. The problems are perturbed so that recalling the original answer does not solve them.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://ds1000-code-gen.github.io/","indexing_mode":"index","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[],"history":"","construction":"","limitations":"","saturation":"","scores":[]}},"task_id":"55a13602-f17b-535b-b185-c7c44b531d47","task_key":"default--test--799","task_revision_id":"1","upstream_id":"799","short_description":"Basically, I am just trying to do a simple matrix multiplication, specifically,…","config":"default","split":"test","body":"{\"library\":\"Scipy\",\"prompt\":\"Problem:\\nBasically, I am just trying to do a simple matrix multiplication, specifically, extract each column of it and normalize it by dividing it with its length.\\n    #csc sparse matrix\\n    self.__WeightMatrix__ = self.__WeightMatrix__.tocsc()\\n    #iterate through columns\\n    for Col in xrange(self.__WeightMatrix__.shape[1]):\\n       Column = self.__WeightMatrix__[:,Col].data\\n       List = [x**2 for x in Column]\\n       #get the column length\\n       Len = math.sqrt(sum(List))\\n       #here I assumed dot(number,Column) would do a basic scalar product\\n       dot((1/Len),Column)\\n       #now what? how do I update the original column of the matrix, everything that have been returned are copies, which drove me nuts and missed pointers so much\\nI've searched through the scipy sparse matrix documentations and got no useful information. I was hoping for a function to return a pointer/reference to the matrix so that I can directly modify its value. Thanks\\nA:\\n<code>\\nfrom scipy import sparse\\nimport numpy as np\\nimport math\\nsa = sparse.random(10, 10, density = 0.3, format = 'csc', random_state = 42)\\n</code>\\nsa = ... # put solution in this variable\\nBEGIN SOLUTION\\n<code>\\n\"}","display_format":"code","language":"","answer_status":"published","assets":[],"source_url":"https://ds1000-code-gen.github.io/","history":"initial import","indexing_mode":"index","subproblems":[],"grids":[]}