I am just getting started with pandas in the IPython Notebook and encountering the following problem: When a DataFrame
read from a CSV file is small, the IPython Notebook displays it in a nice table view. When the DataFrame
is large, something like this is ouput:
In [27]: evaluation = readCSV("evaluation_MO_without_VNS_quality.csv").filter(["solver", "instance", "runtime", "objective"]) In [37]: evaluation Out[37]: <class 'pandas.core.frame.DataFrame'> Int64Index: 333 entries, 0 to 332 Data columns: solver 333 non-null values instance 333 non-null values runtime 333 non-null values objective 333 non-null values dtypes: int64(1), object(3)
I would like to see a small portion of the data frame as a table just to make sure it is in the right format. What options do I have?
To show the full data without any hiding, you can use pd. set_option('display. max_rows', 500) and pd. set_option('display.
DataFrame - head() function This function returns the first n rows for the object based on position. It is useful for quickly testing if your object has the right type of data in it. Number of rows to select. The first n rows of the caller object.
df.head(5) # will print out the first 5 rows df.tail(5) # will print out the 5 last rows
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With