Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org [SOLVED] python : NumPy : Array, Matrix Formatting
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 08-04-2011, 03:22 AM #1 cin_ Member   Registered: Dec 2010 Posts: 281 Rep: python : NumPy : Array, Matrix Formatting pour posteritie, Formatting with NumPy ... " One dimensional arrays are then printed as rows, bidimensionals as matrices and tridimensionals as lists of matrices. " Code is essentially... Code: ```import numpy as whatisgoingonwiththeformattingofmy print 33 pseudomatrix = [ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32] -- this repeats itself 29 times... -- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32] ] print whatisgoingonwiththeformattingofmy.array([pseudomatrix])``` And the output is... Code: ```# ./pseudomatrix 33 [[ 0 0 0 ..., 0 0 0] [ 0 1 2 ..., 30 31 32] [ 0 1 2 ..., 30 31 32] ..., [ 0 1 2 ..., 30 31 32] [ 0 1 2 ..., 30 31 32] [ 0 1 2 ..., 30 31 32]]``` To remove this formatting built in, Add this, or some variant, to your code... Code: ```import numpy as whatisgoingonwiththeformattingofmy set_printoptions(threshold='nan') set_printoptions(linewidth=100) ...``` set_printoptions() : http://docs.scipy.org/doc/numpy/refe...ntoptions.html Last edited by cin_; 08-05-2011 at 09:03 PM. Reason: gramm`err
 08-05-2011, 01:25 AM #2 EricTRA LQ Guru   Registered: May 2009 Location: Gibraltar, Gibraltar Distribution: Fedora 20 with Awesome WM Posts: 6,805 Blog Entries: 1 Rep: Hi, Thanks for sharing. Off the Zero Reply List. Kind regards, Eric
 08-05-2011, 08:56 PM #3 cin_ Member   Registered: Dec 2010 Posts: 281 Original Poster Rep: Documentation It originally began as a question. I searched the forum and could not find anything... I am not authorised to create my own tags, but I though NumPy would have been a good tag for this post... so I decided to dig through the documentation. Some time later I thought I'd share the conclusions to save others the time and give the forum another search result. Last edited by cin_; 08-05-2011 at 09:00 PM. Reason: gramm`err

 Tags array, formatting, matrix, python

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post netnix99 Linux - Software 4 07-06-2011 02:30 PM strimp099 Linux - Server 0 02-12-2011 08:03 AM zoopside Linux - Software 3 04-01-2009 08:42 PM ufmale Programming 2 08-26-2008 12:59 AM uranologist Linux - Software 0 09-28-2003 11:08 PM

LinuxQuestions.org

All times are GMT -5. The time now is 07:18 PM.

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -