liveBook · Manning

Data exploration

As explained in Financial AI in Practice

Exploratory data analysis is the examination of data to understand its structure, quality, and distributions before further analysis or modeling.

Data exploration is the initial inspection of a dataset to understand its structure, quality, and distributions before modeling or transforming it. In financial workflows, it helps teams spot data issues and decide what to investigate or prepare next. section 5.3.2 section 9.3.1

A practical exploration can:

  • Check shape, data types, missing values, unique counts, and sample rows. section 5.3.2
  • Plot target-class proportions and categorical frequencies to reveal imbalance or rare labels. section 5.3.2
  • Compare numeric-feature distributions across target classes to notice outliers, separation, or possible binning opportunities. section 5.3.2
  • Use findings to guide data cleaning and later feature engineering, while treating plots as starting points rather than complete feature selection. section 5.3.2
Listing 5.5 Summary function
def summary(df):                                             #1
    summ = pd.DataFrame(df.dtypes, columns=['data type'])
    summ['#missing'] = df.isnull().sum().values
    summ['%missing'] = (df.isnull().sum().values / len(df)) * 100
    summ['#unique'] = df.nunique().values

    desc = df.describe(include='all').transpose()    #2
    if 'min' in desc.columns:
        summ['min'] = desc['min'].values
    else:
        summ['min'] = np.nan

    if 'max' in desc.columns:
        summ['max'] = desc['max'].values
    else:
        summ['max'] = np.nan

    if len(df) > 0:
        summ['first value'] = df.iloc[0].values
    if len(df) > 1:
        summ['second value'] = df.iloc[1].values
    if len(df) > 2:
        summ['third value'] = df.iloc[2].values

    return summ           #3

print("Initial data shape:", df.shape)     #4
summary_df = summary(df)         #5
display(summary_df.head(10))    #6

A pandas summary function reports each column’s type, missingness, unique count, available minimum and maximum, and sample values. section 5.3.2

Credit and fraud data

A credit dataset’s target plot shows about 74% nondefaults and 26% defaults, making class imbalance visible before modeling. Initial inspection of transaction data similarly checks columns, types, non-null counts, and the fraud-label distribution before converting the table into a graph. section 5.3.2 section 9.3.1

How Financial AI in Practice covers it

How deep it goes
Demonstrates summary checks, cleaning context, and distribution plots, but stops short of deep feature selection.
Examples
Uses credit-default proportions, categorical countplots, target-colored numeric histograms, and transaction-table summaries.
What you can do after
Evaluate/understand datasets by spotting missingness, imbalance, rare categories, outliers, and distribution differences.
How it connects
Connects data cleaning and feature engineering with credit scoring, fraud detection, and graph analytics.

Also explained in

Compare how 13 books explain data exploration →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Financial AI in Practice. The section links point to the parts of the book it draws on.