Python Pandas Beginning End of File - chrisbitm/python GitHub Wiki
Viewing Rows of Data
If you ever used a Terminal (Or Command Prompt, Console) on a Unix Machine, you would be familiar with the head
and tail
Property.
Head
# Modules
import pandas
# Expressions
df = pandas.read_csv(Location of File, sep="xxx")
anfang = df.head()
# Statements
print(anfang)
Tail
# Modules
import pandas
# Expressions
df = pandas.read_csv(Location of File, sep="xxx")
ende = df.tail()
# Statements
print(ende)
In both of the above Examples, if you do not pass a Parameter (Number of rows), Output will either be the First or Last Five Rows by default. Contrary to the above, replace Value xxx
with proper Delimiter. If the Delimiter is a Comma, you needn't worry about passing a Value to sep
since the Character is default Delimiter to Pandas.
Also, you can just use print(df)
Statement but it won't display all the Data if the File has many Rows of Data.