KitDocumentation

ColumnDataTypes

Stores the data types of one or more columns in a variable. The print option makes it easy to see the data type of each column. This kit is commonly used when trying to determine why an operation is not successful and you need to determine if the columns are the data types you expect.

Options

columns: Specifies the columns to check data types for

Examples

Example 1 - Get Data Types of All Columns

Quickly inspect the data types of each column in a dataframe. This is useful to understand the structure of your data and ensuring that numeric, string, and date fields are correctly typed before performing any operations.
#> ColumnDataTypes --print
AFLEFT 
bankTransactionsDfDataTypes = bankTransactionsDf.dtypes
print(bankTransactionsDfDataTypes) #)2 AFRIGHT

Example 2 - Get Data Type of a Single Column

Sometimes we only want to inspect the type of a specific column. This example shows how to print the data type of the TransactionAmount column without examining the entire dataframe.
#> ColumnDataTypes TransactionAmount --print
AFLEFT 
bankTransactionsDfDataTypes = bankTransactionsDf[ [ 'TransactionAmount' ] ].dtypes
print(bankTransactionsDfDataTypes) #)4 AFRIGHT

Example 3 - Get Data Types of Multiple Columns

Instead of checking all columns, you can target just a few. Here, we retrieve the data types of the AccountID, LoginAttempts, and PreviousTransactionDate columns to verify how these specific fields are stored.
#> ColumnDataTypes AccountID LoginAttempts PreviousTransactionDate --print
AFLEFT 
bankTransactionsDfDataTypes = bankTransactionsDf[ [ 'AccountID', 'LoginAttempts', 'PreviousTransactionDate' ] ].dtypes
print(bankTransactionsDfDataTypes) #)6 AFRIGHT