Skip to content

Instantly share code, notes, and snippets.

@khiemdoan
Created November 4, 2019 15:20
Show Gist options
  • Save khiemdoan/11ba68fe66290999ad33e7f67760274c to your computer and use it in GitHub Desktop.
Save khiemdoan/11ba68fe66290999ad33e7f67760274c to your computer and use it in GitHub Desktop.
from IPython.display import display

def summary_data(data):
    print(f'Dataframe dimensions: {data.shape}')
    tab_info = pd.DataFrame(data.dtypes).T.rename(index={0: 'column type'})
    tab_info = tab_info.append(pd.DataFrame(data.isnull().sum()).T.rename(index={0: 'null values (nb)'}))
    tab_info = tab_info.append(pd.DataFrame(data.isnull().sum() / data.shape[0] * 100).T.rename(index={0: 'null values (%)'}))
    display(tab_info)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment