application_vnd.jupyter.stderr_output_1.png
from string import punctuation

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

biology = pd.read_csv('../input/biology.csv')
cooking = pd.read_csv('../input/cooking.csv')
crypto = pd.read_csv('../input/crypto.csv')
diy = pd.read_csv('../input/diy.csv')
robotics = pd.read_csv('../input/robotics.csv')
travel = pd.read_csv('../input/travel.csv')
test = pd.read_csv('../input/test.csv')

def strip_punctuation(s):
    return ''.join((c for c in s if c not in punctuation))
def remove_html(s):
    soup = BeautifulSoup(s, 'html.parser')
    content = soup.get_text()
    return content
def text_transform(dataframe):
    dataframe['title'] = dataframe['title'].apply(lambda x: strip_punctuation(str.lower(x)))
    dataframe['content'] = dataframe['content'].apply(lambda x: strip_punctuation(str.lower(remove_html(x))))
def load_data(name):
    utl = '../input/' + name + '.csv'
    files = pd.read_csv(utl)
    text_transform(files)
    files['category'] = name
    return files
def merge_data(list_of_files):
    list_of_dataframe = [''] * len(list_of_files)
    for i in range(0, len(list_of_files)):
        list_of_dataframe[i] = load_data(list_of_files[i])
    data = pd.concat(list_of_dataframe, axis=0, ignore_index=True)
    return data

data[0:5]