标签: tabular

NumPy:漂亮的打印表格数据

我想打印NumPy表格数组数据,以便它看起来不错.R和数据库控制台似乎表现出很好的能力.但是,NumPy的表格数组的内置打印看起来像垃圾:

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, 'long string')
#  (3, 9.9999999999999995e-008, 'ABCD')]

print(repr(dat))
# array([(0, 0.0001, 'ABCD'), (1, 1.0000000000000001e-005, 'ABCD'),
#        (2, 9.9999999999999995e-007, 'long string'),
#        (3, 9.9999999999999995e-008, 'ABCD')], 
#       dtype=[('column_one', '<i4'), ('col_two', '<f8'), ('column_3', '|S12')])
Run Code Online (Sandbox Code Playgroud)

我希望看起来更像数据库吐出的东西,例如postgres风格: …

python numpy pretty-print tabular

14
推荐指数
4
解决办法
3万
查看次数

vim表格只在第一场比赛的线上?

我正在尝试使用tabular.vim插件格式化一些python代码.它目前是sqlalchemy声明类,看起来像这样:

id     =  db.Column(db.Integer, primary_key=True)
status    =  db.Column(db.Integer, nullable=False, default=3)
...etc...
Run Code Online (Sandbox Code Playgroud)

我希望能够只对齐列表中的第一个等号.

id     =  db.Column(db.Integer, primary_key=True)
status =  db.Column(db.Integer, nullable=False, default=3)
...etc...
Run Code Online (Sandbox Code Playgroud)

只是一个常规

: Tabularize /=
Run Code Online (Sandbox Code Playgroud)

似乎与一切相符,一切都变得疯狂.

首先十分感谢!

format vim formatting tabular

13
推荐指数
3
解决办法
2466
查看次数

具有未知列数的AngularJS动态表

我是Angular的新手,我的项目需要一些起点.如何通过鼠标单击背景从ajax数据创建新表?我知道ajax数据的列数未知,并且可能会不时有所不同.

例如:

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 |
Run Code Online (Sandbox Code Playgroud)

dynamic tabular angularjs

13
推荐指数
1
解决办法
5万
查看次数

表格中的垂直和水平标题?

如何获得包含水平和垂直标题的表格?

所以,例如

         header1 header2 header3 
header1    1        1      1
header2    2        2      2 
header3    3        3      3 
Run Code Online (Sandbox Code Playgroud)

html css tabular

12
推荐指数
3
解决办法
2万
查看次数

将几个相同的值字段分组到单个单元格中

首先,记录按表组件显示在表中,但不在报表中显示.

结果如下:

 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     
       Dec      137632     
 =====================================
       Jan-Dec  1664862
 =====================================
Run Code Online (Sandbox Code Playgroud)

总部列显示了每个季度的总和.

重复字段值时不会打印它们.

问题是如何对sumquarter的列进行分组,以便每行中第一个打印的重复值加入下一个重复值,成为单个单元格,直到它满足非重复值?

你可以在图像中看到它.下面是表格显示的图像,我喜欢的解决方案是将这3个月的总和分组到一个单元格中. …

jasper-reports ireport tabular

12
推荐指数
1
解决办法
3万
查看次数

LaTeX,如何在页面中放置一个大表

以下LaTeX代码生成一个表,但它包含较小的字体大小,并且不适合页面:

\documentclass{article}
\usepackage{tabularx} % in the preamble
\usepackage{graphicx}

\begin{document}

        \begin{table}[]
    \centering
    \caption{My caption}
    \label{my-label}
    \resizebox{\textwidth}{!}{%
    \begin{tabular}{lllll}
    Detection Methods & Supervised /Semi-supervised/ Unsupervised & Technique Used                                                                    & Applications                                            & Technology                                                           \\
    Statistical       &                                           & Gaussian-based detection                                                          & Online anomaly detection                                & Conventional   data centres                                          \\
    Statistical       &                                           & Gaussian-based detection                                                          & General                                                 & General                                                              \\
    Statistical       &                                           & Regression analysis                                                               & Globally-distributed commercial applications            & Distributed, Web-based, Application \& System metrics                \\
    Statistical       &                                           & Regression analysis                                                               & Web applications                                        & …
Run Code Online (Sandbox Code Playgroud)

latex tabular

11
推荐指数
1
解决办法
3万
查看次数

如何使用LaTeX表中的图像垂直居中文本?

我想在LaTeX中将文本与大图像的中心对齐.不幸的是,文本some text与图像的底部对齐:

\begin{tabular}{cc}
    some text & \includegraphics{image_name.eps}
\end{tabular}
Run Code Online (Sandbox Code Playgroud)

我发现一个网站建议使用m{width of the cell}而不是表中c的那一列,但它没有用.

\begin{tabular}{m{1in}c}
    some text & \includegraphics{image_name.eps}
\end{tabular}
Run Code Online (Sandbox Code Playgroud)

我相信乳胶专业人员会看到这个并知道该怎么做!这意味着在你教我之前我不能成为一名LaTeX专业人士......

latex image alignment tabular

10
推荐指数
1
解决办法
1万
查看次数

在Python中打印表格数据

在Python中打印表格数据的最佳方法是什么?假设数据在2D列表中,我想创建一个智能外观的表.我实际拥有的是一个字典列表,我想根据字典中的值打印一个交集.就像是

for val1 in my_dict:
   for val2 in my_dict:
    if val1['a'] > val2['a']:
      print 'x'
Run Code Online (Sandbox Code Playgroud)

但是这样每个列的宽度都是固定的.Writer和格式化程序类似乎是可能性的东西,但与Perl的格式化程序相比,它仍然看起来很复杂.

是否有任何现有的实现或我必须自己编写?

python tabular

10
推荐指数
3
解决办法
2万
查看次数

Python:限制pandas DataFrame的打印列的宽度

我正在尝试打印一个pandas DataFrame.其中一列太宽(这是一个非常长的字符串).打印我正在使用tabulate库.但是当它被打印时,它会在一个很长的行中显示所有列的全部内容.这是我看到的:

row  name                                                                                                review                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                rating

0  Planetwise Flannel Wipes                                                                            These flannel wipes are OK, but in my opinion not worth keeping.  I also ordered someImse Vimse Cloth Wipes-Ocean Blue-12 countwhich are larger, had a nicer, softer texture and just seemed higher quality.  I use cloth wipes for hands and faces and have been usingThirsties 6 Pack Fab Wipes, Boyfor about 8 months now and need to replace them because they are starting to get rough and have …
Run Code Online (Sandbox Code Playgroud)

python pretty-print tabular python-2.7 pandas

10
推荐指数
1
解决办法
8256
查看次数

在tabularx中对齐列

我想正确对齐最后一列.最后有额外的空间.请让我知道如何做到这一点.谢谢.

\documentclass[11pt]{article}
\usepackage{setspace}                                   %double spacing and spacing in tables                           
\usepackage{amsmath}                                    %equations etc. in latex
\usepackage[capposition=top]{floatrow}                  %so that the caption for figures appear at the top
\usepackage[tablename=TABLE,figurename = FIGURE,labelsep=newline,aboveskip=0pt,font=bf,justification=centering]{caption}   %so that caption looks cool
\usepackage{booktabs}                                   %midrule etc. which adds space around lines. Make tables look good. 
\usepackage{tabularx}                                   %use tabularx environment for creating one page tables
\usepackage[margin=1in]{geometry}                       %defining the margin for the page
\usepackage[autostyle]{csquotes}                        %for quotes. alternative would be " and "
\usepackage[table]{xcolor}                              %rowcolor, cellcolor, color for references
\usepackage{pdflscape}                                  %landscape and keep …
Run Code Online (Sandbox Code Playgroud)

alignment tabular

10
推荐指数
1
解决办法
2187
查看次数