Questions tagged [tabulate]

Count or tally of named items in an object or structure.

Various languages will have different functions for this operation. "table" or "crosstabs" are two such examples. The output may be multi-dimensional.

168 questions
0
votes
1 answer

Python Tabulate - How to print vertically list with values from an input

I am making a console program in Python where the user can add multiple values ​​to multiple lists and create a contact book. I already have all the data in a different list, now I need to print this data in a table, with the TABULATE module. I can…
Luiz Villalba
  • 149
  • 1
  • 2
  • 13
0
votes
1 answer

How to I get data from tabulated data then print a message

I have below output after tabulating response from cloudwatch using get_metric_statistics. I would like to add validation that if any Sum is greater than 0 it will print a message saying there is an error. And if all Sum is equal to zero it will say…
0
votes
1 answer

The string is not callable in Python

I am trying to export a dict to a csv. I am pulling data from an api and need it to print to a CSV. I am using: import datetime import csv import pendulum import requests from tabulate import tabulate import pandas as pd import numpy as np The API…
JasonBeedle
  • 338
  • 2
  • 14
0
votes
0 answers

distorted output in python IDLE while using tabulate or texttable libraries

I tried to print output in a nice table using texttable, code given below from texttable import Texttable t = Texttable() t.add_rows([['Name', 'Age'], ['Alice', 24], ['Bob', 19]]) print(t.draw()) the code works fine and gives an output but the…
19042003
  • 1
  • 1
0
votes
2 answers

How to add vertival headers in tabulate?

So I made a table in tabulate and the output looks like this: But I want it to look like this: So how do I do that ? this is my code: from tabulate import tabulate nums = {"Numbers": [0, 3.5, " ", -2, " "], "Seconds": [" ", " ", 24, " ",…
Rami Menai
  • 50
  • 7
0
votes
1 answer

Printing two-dimentional table

I have a SAS table that looks something like that: Mark Country Type Count Price 1 Mark1 Country1 type1 1 1.50 2 Mark1 Country1 type2 5 21.00 3 Mark1 Country1 type3 NA NA 4 Mark2 Country2 type1 2 197.50 5…
adeline
  • 21
  • 4
0
votes
0 answers

NLTK Brown Corpus: Tabulate Function does not work

The code is excerpted from Natural Language Processing with Python, page 119. Frequency of modals in different sections of the Brown Corpus. My issue turns out to be that it fails to tabulate like the book describes. Basically I don't know why this…
0
votes
1 answer

Tabulate relative frequencies in Stata

I am trying to tabulate frequencies for a variable divided in two groups. That is, I would like to see how much a variable takes value "Yes" divided by both region and sex. Now, this is easy to do in Stata using "tab" and option row, but I have…
Tom
  • 1
0
votes
3 answers

Macro loop to generate Proc Tabulate by origin

Using SASHELP.CARS, I would like to make a PROC TABULATE by Origin. So, the first way is to make 3 PROC TABULATE such as : PROC TABULATE DATA = data out=tabulate; where Origin="Asia"; CLASS Make DriveTrain ; TABLE (Make),…
Siva Kg
  • 59
  • 8
0
votes
1 answer

Why print nltk.ConditionalFreqDist tabulate has None in output?

Using Anaconda Spyder, Python 3.8.3, nltk 3.5. The code and output below: from nltk.corpus import reuters cfd = [('gas', word) for word in brown.words(categories='gas')] print(cfd.tabulate(conditions=['gas'], samples=['gasoline',…
vin
  • 1
  • 1
  • 5
0
votes
2 answers

how to Remove all occurrences of a char in a 3d python List coming from a file

The python code is: resolution = (4,4,4) permList = [] with open("perm.txt",'r') as perm: file_lines = list(perm) for i in range(0, len(file_lines), resolution[2]): permList.append([list(line.rstrip()) for line in…
0
votes
1 answer

Equivalent of "tabulate" and "C"of R in python

I am currently working on transferring code available in R to python. In R, there is a function called tabulate and C. Is there is any function available in python that is equivalent to tabulate and C function of R?
Ankita
  • 485
  • 5
  • 18
0
votes
1 answer

Can you divide the entries of two tables?

I have 2 tables in Stata: one shows the count of total parents in each state that had a divorce in the specific divorce year cohort, the other shows the count of divorced parents with csphycus == 2 in each state and divorce year cohort. I want a…
0
votes
1 answer

Tabulate module in Python not giving the desired output

I am using tabulate in Python for list: import tabulate import tabulate List4 = ['xyz-34t', 'abc-237', 'abc-eq1'] print tabulate(List4) Expected output is xyz-34t abc-237 abc-eq1 Actual output: x y z - 3 4 t a b c - 2 3 7 a b c - e q 1
0
votes
1 answer

SAS: Change order of variable values in PROC TABULATE

I have the following sample data: DATA offenders; INPUT id :$12. age :3. sex :$1. residenceStatus :$1.; INFORMAT id $12.; INFILE DATALINES…
D. Studer
  • 1,711
  • 1
  • 16
  • 35