Asked By – Curious2learn
I have a csv file with the name
params.csv. I opened up
ipython qtconsole and created a pandas
import pandas paramdata = pandas.read_csv('params.csv', names=paramnames)
paramnames is a python list of string objects. Example of
paramnames (the length of actual list is 22):
paramnames = ["id", "fc", "mc", "markup", "asplevel", "aspreview", "reviewpd"]
At the ipython prompt if I type
paramdata and press enter then I do not get the dataframe with columns and values as shown in examples on Pandas website. Instead, I get information about the dataframe. I get:
In: paramdata Out: <class 'pandas.core.frame.DataFrame'> Int64Index: 59 entries, 0 to 58 Data columns: id 59 non-null values fc 59 non-null values mc 59 non-null values markup 59 non-null values asplevel 59 non-null values aspreview 59 non-null values reviewpd 59 non-null values
If I type
paramdata['mc'] then I do get the values as expected for the
mc column. I have two questions:
(1) In the examples on the pandas website (see, for example, the output of
df here: http://pandas.sourceforge.net/indexing.html#additional-column-access) typing the name of the dataframe gives the actual data. Why am I getting information about the dataframe as shown above instead of the actual data? Do I need to set some output options somewhere?
(2) How do I output all columns in the dataframe to the screen without having to type their names, i.e., without having to type something like
I am using pandas version 0.8.
Now we will see solution for issue: Output data from all columns in a dataframe in pandas [duplicate]
There is too much data to be displayed on the screen, therefore a summary is displayed instead.
If you want to output the data anyway (it won’t probably fit on a screen and does not look very well):
converts the dataframe to its numpy-array matrix representation.
stores the respective column names and
stores the respective index (row names).
This question is answered By – eumiro
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0