A data type classifies the values a field can contain. In tabular data, every column shares a common type, such as integer, string, or floating-point number, helping describe and handle its values appropriately. section 1.1 section 2.1.3
Common tabular column types include:
- Numeric values, represented by integers or floating-point numbers; continuous measurements such as units per US dollar use real numbers. section 1.1 section 2.1.3
- Categorical values, drawn from a finite set such as country, currency name, gender, or education level. section 1.1 section 2.1.3
- Free-form text, which can contain varied values or no value, as with currency nicknames. section 1.1
- Date, datetime, and boolean values, which can represent temporal fields or binary features. section 2.1.3
A small customer dataset
A pandas DataFrame can combine gender and education_level categories with integer age and numeric income. Four labeled rows represent Bob, Alice, Charlie, and Emily; selecting Alice returns all four typed attributes. section 2.1.3
Listing 2.1 Creating a simple tabular dataset
import pandas as pd
data = {'gender': ['male', 'female', 'male', 'female'],
'age': [25, 30, 27, 29],
'education_level': ['Bachelor', 'Master', 'Bachelor', 'PhD'],
'income': [50000, 60000, 55000, 70000]} #1
index = [ 'Bob ', 'Alice', 'Charlie', 'Emily'] #2
df = pd.DataFrame(data, index=index) #3
print(df)
print(df.iloc[1]) #4
print(df.loc['Alice']) #5
Inspect a runnable pandas example that creates a mixed-type DataFrame and accesses rows by index and label. section 2.1.3

















