<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Practical Deep Learning for Coders, v3
Lesson4_tabular
Tabular models
Tabular(表格)模型
Step1:  Tabular data should be in a Pandas DataFrame.
Tabular数据是Pandas里的DataFrame。
Step2:  Inference  预测
<ASSISTANT_TASK:>
Python Code:
from fastai.tabular import *
Explanation: Practical Deep Learning for Coders, v3
Lesson4_tabular
Tabular models
Tabular(表格)模型
End of explanation
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]
test = TabularList.from_df(df.iloc[800:1000].copy(), path=path, cat_names=cat_names, cont_names=cont_names)
data = (TabularList.from_df(df, path=path, cat_names=cat_names, cont_names=cont_names, procs=procs)
                           .split_by_idx(list(range(800,1000)))
                           .label_from_df(cols=dep_var)
                           .add_test(test)
                           .databunch())
data.show_batch(rows=10)
learn = tabular_learner(data, layers=[200,100], metrics=accuracy)
learn.fit(1, 1e-2)
Explanation: Tabular data should be in a Pandas DataFrame.
Tabular数据是Pandas里的DataFrame。
End of explanation
row = df.iloc[0]
learn.predict(row)
Explanation: Inference  预测
End of explanation
<END_TASK>