# In[1]
import os
path = ‘/home/zjdou/jupyter/root/Smart-Writing/TextClassification/DATA‘
os.chdir(path)
print(os.getcwd())
# In[2]
import pandas as pd
import numpy as np
file01 = pd.read_json(‘./raw_data/gov01.json‘)
file01
file02 = pd.read_json(‘./raw_data/gov02.json‘)
file02
total = file01.append(file02, ignore_index=True)
# In[2]
no_label_idx = total[total[‘topics‘].apply(lambda x:x[0]) == ‘‘].index
no_label_idx
total.drop(no_label_idx, inplace=True)
total.reset_index(drop=True, inplace=True)
# In[2]
total[‘topics‘] = total[‘topics‘].apply(lambda x:x[0])
total
# In[3]
total.to_json(‘./swtc/total.json‘)
# In[4]
# 分割数据
pandas处理行数据