Hello guys. How are you all? I hope you all fine. In this tutorial we will learn about how to print Data in Tabular Format in Python. so without wasting time lets learn about of this.
How to print Data in Tabular Format in Python
print Data in Tabular Format in Python
to print Data in Tabular Format in Python just Use formate.By using formate you can print Data in Tabular Format in Python. It is very easy to use. Lets learn about of this by given below example:
dict = [ ["july", 15, 95], ["mitva", 12, 98], ["karan", 15, 92]] print ("{:<10} {:<10} {:<10}".format('Name','Age','Percent')) for v in dict: name, age, perc = v print ("{:<10} {:<10} {:<10}".format( name, age, perc))
Output :Name Age Percent july 15 95 mitva 12 98 karan 15 92
How to print Data in Tabular Format in Python
to print Data in Tabular Format in Python just Use pandas.dataframe(). By using pandas.dataframe() you can print Data in Tabular Format in Python. It is very easy to use. Lets learn about of this by given below example:
import pandas as pd dict = [ ["july", 15, 95], ["mitva", 12, 98], ["karan", 15, 92]] df = pd.DataFrame(dict, columns = ['Name','Age','Percent']) print(df)
Output :Name Age Percent july 15 95 mitva 12 98 karan 15 92
python print tables
To print Data in Tabular Format in Python just Use formate.By using formate you can print Data in Tabular Format in Python. It is very easy to use. Lets learn about of this by given below example:
dict = [ ["july", 15, 95], ["mitva", 12, 98], ["karan", 15, 92]] print ("{:<10} {:<10} {:<10}".format('Name','Age','Percent')) for v in dict: name, age, perc = v print ("{:<10} {:<10} {:<10}".format( name, age, perc))
Output :Name Age Percent july 15 95 mitva 12 98 karan 15 92
Method 1: Use formate
By using formate you can print Data in table Format. It is very easy to use. Lets learn about of this by given below example:
dict = [ ["july", 15, 95],
["mitva", 12, 98],
["karan", 15, 92]]
print ("{:<10} {:<10} {:<10}".format('Name','Age','Percent'))
for v in dict:
name, age, perc = v
print ("{:<10} {:<10} {:<10}".format( name, age, perc))
Output :
Name Age Percent
july 15 95
mitva 12 98
karan 15 92
Method 2: Use pandas.dataframe()
By using pandas.dataframe() you can print Data in table Format in Python. It is very easy to use. Lets learn about of this by given below example:
import pandas as pd
dict = [ ["july", 15, 95],
["mitva", 12, 98],
["karan", 15, 92]]
df = pd.DataFrame(dict, columns = ['Name','Age','Percent'])
print(df)
Output :
Name Age Percent
july 15 95
mitva 12 98
karan 15 92
Conclusion
It’s all About this Tutorial. Hope all methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you?
Also, Read