I have a csv file which I am reading using Pandas. I want to print the entire dataframe so that I can check which columns are of string
data type, because I want to apply pd.to_numeric()
function to such columns to convert them into float
data type.
The dataframe is only 156x30,so printing it in it's entirety should not be much of a problem. I checked dataframe.values method but there is no parameter I can specify to do this directly. Following is my code:
import pandas as pd
file_ = pd.read_csv("path/to/csvfile")
file_.values
which returns:
array([[1991, 'Berlin', 4.8, ..., '25,428.00', 4.8, nan],
[1992, 'Berlin', 5.0, ..., '32,054.00', 5.0, nan],
[1993, 'Berlin', 5.3, ..., '22,193.00', 5.3, nan],
...,
[2014, 'Stuttgart', 4.8, ..., '103,027.00', 4.8, nan],
[2015, 'Stuttgart', 4.4, ..., '110,668.00', 4.4, nan],
[2016, 'Stuttgart', 3.9, ..., '108,562.00', 3.9, nan]], dtype=object)
I want to print this dataframe in it's entirety. Is there any way to do that? Thanks.