473,289 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

setting and getting column in numpymatrix

hi
i am looking for an efficient way to get a specific column of a
numpy.matrix ..
also i want to set a column of the matrix with a given set of
values ..i couldn't find any methods for this in matrix doc..do i have
to write the functions from scratch?

TIA
dn

Nov 1 '07 #1
1 1307
de****@gmail.com wrote:
hi
i am looking for an efficient way to get a specific column of a
numpy.matrix ..
also i want to set a column of the matrix with a given set of
values ..i couldn't find any methods for this in matrix doc..do i have
to write the functions from scratch?

TIA
dn
>>from numpy import matrix
x=matrix([[1,2,3],[4,5,6],[7,8,9]])
x[:,1]
matrix([[2],
[5],
[8]])
>>x[:,1].transpose()
matrix([[2, 5, 8]])
>>matrix([11,12,13]).transpose()
matrix([[11],
[12],
[13]])
>>x[:,1] = matrix([11,12,13]).transpose()
x
matrix([[ 1, 11, 3],
[ 4, 12, 6],
[ 7, 13, 9]])
Nov 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris | last post by:
Hi, I am filling a server side listbox in an asp.net app Each text value for each item in the list is created by concatenating to string values together. I want to give the appearance of...
5
by: alan_atwood | last post by:
I am looking to produce a query that will in addition to displaying the data will generate a counter that will be incremented by one with each row of the resultset. For example, my resultset would...
2
by: Sagaert Johan | last post by:
Hi I have set the columreorder to true Is there a way to get/set the current columnorder, so i can restore the order from a saved setting ? Johan
0
by: swapnil | last post by:
Hi , i am using UltraGrid in my application and assigning a DataTable to it as a DataSource. I am having 1 column in that dataTable of type String of size 1, where string will be stored as F or T...
5
by: Dennis | last post by:
I have a class that inherits from DataGrid. I can set the rowheights in a DataGrid by tappig into the "get_Datagridrows" method. However, this does not work for classes that inherit from...
4
by: Rich | last post by:
Hello, I have a one datagrid that will be based on different datatables. One datatable may have 7 columns, another 15... With the tables that have more columns, I have been manually dragging...
4
by: Chuck | last post by:
I'm setting the column with for a gridview (25+- columns) and have paging turned on. When the gridview is first displayed, the column widths are all set to the default. But after paging to...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
3
by: Annette Block | last post by:
I'm rather new in JavaScript, but I have some experience in php. I learned it's rather easy to open a window of a specified size with JavaScript, that you need to specify the opened file, but I...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.