With this hack, you can get the unique values and the type of every column so you can have a better understanding of your data.
For this example, we will use the Titanic dataset from Kaggle.
import pandas as pd import numpy as np df=pd.read_csv('train.csv') df.head()
The Code
pd.DataFrame({"values":{col:df[col].unique() for col in df},'type':{col:df[col].dtype for col in df}})
As you can see, the output is a data-frame that has as index the columns of our original data along with a column that contains their unique values and a column that contains their data type.