tabular

Formatting Text in a Table in Python

南楼画角 提交于 2019-11-27 08:27:43
问题 I'm having issues creating a table that is dynamic to adjust to various results. I've written a screen scraper to pull stocks from http://finance.yahoo.com and print the company name, it's symbol, and it's current stock price. However the output looks like this: Microsoft Corporation MSFT 29.76 Apple Inc. AAPL 396.77 SPDR S&P 500 SPY 155.25 Google Inc. GOOG 787.76 I want it to look like Microsoft Corporation MSFT 29.76 Apple Inc. AAPL 396.77 SPDR S&P 500 SPY 155.25 Google Inc. GOOG 787.76 I

NumPy: Pretty print tabular data

陌路散爱 提交于 2019-11-27 04:39:06
I would like to print NumPy tabular array data, so that it looks nice. R and database consoles seem to demonstrate good abilities to do this. However, NumPy's built-in printing of tabular arrays looks like garbage: import numpy as np dat_dtype = { 'names' : ('column_one', 'col_two', 'column_3'), 'formats' : ('i', 'd', '|S12')} dat = np.zeros(4, dat_dtype) dat['column_one'] = range(4) dat['col_two'] = 10**(-np.arange(4, dtype='d') - 4) dat['column_3'] = 'ABCD' dat['column_3'][2] = 'long string' print(dat) # [(0, 0.0001, 'ABCD') (1, 1.0000000000000001e-005, 'ABCD') # (2, 9.9999999999999995e-007,

Format output in a table, C++

瘦欲@ 提交于 2019-11-27 03:27:15
问题 How can I output data to the console in a table in C++? There's a question for this in C#, but I need it in C++. This, except in C++: How To: Best way to draw table in console app (C#) 回答1: Can't you do something very similar to the C# example of: String.Format("|{0,5}|{1,5}|{2,5}|{3,5}|", arg0, arg1, arg2, arg3); Like: printf("|%5s|%5s|%5s|%5s|", arg0, arg1, arg2, arg3); Here's a reference I used to make this: http://www.cplusplus.com/reference/clibrary/cstdio/printf/ 回答2: Here's a small

Printing tabular data in Python

ぃ、小莉子 提交于 2019-11-27 03:23:39
问题 What's the best way to print tabular data in Python? Say the data is in a 2D list and I want to create a smart looking table. What I actually have is a list of dictionaries and I want to print an intersection depending on values in the dictionaries. Something like for val1 in my_dict: for val2 in my_dict: if val1['a'] > val2['a']: print 'x' but in such a way that each column is fixed width. Writter and formatter classes seem like something in the realm of possibility, but still look complex

AngularJS dynamic table with unknown number of columns

ε祈祈猫儿з 提交于 2019-11-27 02:14:33
问题 I'm new to Angular and I need some start point for my project. How can I create new table from ajax data by mouse click on the background? I know that ajax data has unknown number of columns and can be different from time to time. For example: the first click on background = table 1, ajax request to /api/table | A | B | C | | 1 | 2 | 3 | | 5 | 7 | 9 | the second click on background = table 2 and server returns new data from the same url /api/table | X | Y | | 5 | 3 | | 8 | 9 | 回答1: You could

Escape pipe-character in org-mode

▼魔方 西西 提交于 2019-11-26 22:53:04
问题 I've got a table in Emacs org-mode, and the contents are regular expressions. I can't seem to figure out how to escape a literal pipe-character ( | ) that's part of a regex though, so it's interpreted as a table-cell separator. Could someone point me to some help? Thanks. Update : I'm also looking for escapes for a slash ( / ), so that it doesn't trigger the start of an italic/emphasis sequence. I experimented with \/ and \// - for example, suppose I want the literal text /foo/ in a table

Group several same value field into a single cell

那年仲夏 提交于 2019-11-26 22:46:31
First of all, the records are shown in the table by table component but not in the report one. The results looks like this: YEARS MONTHS SUMMONTH SUMQUARTER ----- ------ -------- ---------- 2009 Jan 130984 432041 Feb 146503 Mar 154554 Apr 147917 435150 May 131822 Jun 155411 Jul 144000 424806 Aug 130369 Sep 150437 Oct 112137 400114 Nov 152057 Dec 135920 ===================================== Jan-Dec 1692111 ===================================== 2010 Jan 139927 417564 Feb 154940 Mar 122697 Apr 163257 413305 May 124999 Jun 125049 Jul 145127 427612 Aug 138804 Sep 143681 Oct 143398 406381 Nov 125351

Divs vs tables for tabular data

懵懂的女人 提交于 2019-11-26 21:36:43
问题 Yes, another divs vs tables questions... I read all over the place that "try to use divs instead of tables", but I have an application that displays data that is tabular, basically my entire web application displays tables (with different columns and data) but everything is tabular... Should I use struggle to use divs? If yes, why? 回答1: Use tables for tabular data. The knock against tables has been when they've been used solely for layout purposes. They have their own purpose, and it's

Display matrix with row and column labels

时间秒杀一切 提交于 2019-11-26 14:23:11
问题 Is there a convenient way to display a matrix with row and column labels in the Matlab terminal? Something like this: M = rand(5); displaymatrix(M, {'FOO','BAR','BAZ','BUZZ','FUZZ'}, ... {'ROW1','ROW2','ROW3','ROW4','ROW5'}); %?? yielding: FOO BAR BAZ BUZZ FUZZ ROW1 0.1622 0.4505 0.1067 0.4314 0.8530 ROW2 0.7943 0.0838 0.9619 0.9106 0.6221 ROW3 0.3112 0.2290 0.0046 0.1818 0.3510 ROW4 0.5285 0.9133 0.7749 0.2638 0.5132 ROW5 0.1656 0.1524 0.8173 0.1455 0.4018 Even better would be something with

NumPy: Pretty print tabular data

青春壹個敷衍的年華 提交于 2019-11-26 11:17:40
问题 I would like to print NumPy tabular array data, so that it looks nice. R and database consoles seem to demonstrate good abilities to do this. However, NumPy\'s built-in printing of tabular arrays looks like garbage: import numpy as np dat_dtype = { \'names\' : (\'column_one\', \'col_two\', \'column_3\'), \'formats\' : (\'i\', \'d\', \'|S12\')} dat = np.zeros(4, dat_dtype) dat[\'column_one\'] = range(4) dat[\'col_two\'] = 10**(-np.arange(4, dtype=\'d\') - 4) dat[\'column_3\'] = \'ABCD\' dat[\