AttributeError: 'TabularList' object has no attribute 'codes'


I’m playing with the code in lesson4-tabular and I ran into this issue.

from fastai.tabular import *

path = untar_data(URLs.ADULT_SAMPLE)
df = pd.read_csv(path/‘adult.csv’)

dep_var = ‘salary’
cat_names = [‘workclass’, ‘education’, ‘marital-status’, ‘occupation’, ‘relationship’, ‘race’]
cont_names = [‘age’, ‘fnlwgt’, ‘education-num’]
procs = [FillMissing, Categorify, Normalize]

If I run this code, it works ok:

data = TabularList.from_df(df, path=path, cat_names=cat_names, cont_names=cont_names, procs=procs)

However, if I want to inspect the class attributes:

import inspect

I get this error:

AttributeError: ‘TabularList’ object has no attribute ‘codes’

I get the same error if I simply run a code block with data in it


I’m wondering if there is a better way to get the attributes of the TabularList class, or if something else is going wrong?

Are you sure you’re on the latest fastai (1.0.41)?

Ah yes, was using a previous version. After updating to 1.0.42, it works great thanks!