Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

print a formatted table using python

d = [ ["Mark", 12, 95],
     ["Jay", 11, 88],
     ["Jack", 14, 90]]
     
print ("{:<8} {:<15} {:<10}".format('Name','Age','Percent'))

for v in d:
    name, age, perc = v
    print ("{:<8} {:<15} {:<10}".format( name, age, perc))
Comment

print a formatted table using python

import pandas as pd

d = [ ["Mark", 12, 95],
     ["Jay", 11, 88],
     ["Jack", 14, 90]]

df = pd.DataFrame(d, columns = ['Name','Age','Percent'])
print(df)
Comment

PREVIOUS NEXT
Code Example
Python :: how to resize tkinter window 
Python :: matplotlib custom legend 
Python :: python convert string to sentence case 
Python :: how to save the model in python 
Python :: pygame key pressed once 
Python :: elif in django template 
Python :: pandas distinct 
Python :: how to save a python object in a file 
Python :: web crawler using python 
Python :: commentaire python 
Python :: list with numbers between 2 values by 
Python :: python check if character is letter 
Python :: python sort dictionary by key 
Python :: how to start a new django project 
Python :: convert list into integer in python 
Python :: pandas column name equal to another column value 
Python :: convert python datetime to string 
Python :: how to sort a dictionary py 
Python :: django month name from month number 
Python :: NumPy unique Syntax 
Python :: custom signal godot 
Python :: python nested list comprehension 
Python :: connect spark to postgres; connect spark to database 
Python :: .text python 
Python :: Sorting Dataframes by Column Python Pandas 
Python :: pd.read_excel column data type 
Python :: self-xss meaning 
Python :: chr() python 
Python :: calculate the distance between two points 
Python :: get file arg0 python 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =