{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "data = pd.read_csv(\"drugsComTest_raw.csv\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "data['problem'] = data['condition'] +\"\\n\" + data['review']" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "data = data[['drugName','condition','review','problem']]" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(53766, 4)" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data.shape" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "data = data[data['problem'].notna()]" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | drugName | \n", "condition | \n", "review | \n", "problem | \n", "
---|---|---|---|---|
0 | \n", "Mirtazapine | \n", "Depression | \n", "\"I've tried a few antidepressants over th... | \n", "Depression\\n\"I've tried a few antidepress... | \n", "
1 | \n", "Mesalamine | \n", "Crohn's Disease, Maintenance | \n", "\"My son has Crohn's disease and has done ... | \n", "Crohn's Disease, Maintenance\\n\"My son has Croh... | \n", "
2 | \n", "Bactrim | \n", "Urinary Tract Infection | \n", "\"Quick reduction of symptoms\" | \n", "Urinary Tract Infection\\n\"Quick reduction of s... | \n", "
3 | \n", "Contrave | \n", "Weight Loss | \n", "\"Contrave combines drugs that were used for al... | \n", "Weight Loss\\n\"Contrave combines drugs that wer... | \n", "
4 | \n", "Cyclafem 1 / 35 | \n", "Birth Control | \n", "\"I have been on this birth control for one cyc... | \n", "Birth Control\\n\"I have been on this birth cont... | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
53761 | \n", "Tamoxifen | \n", "Breast Cancer, Prevention | \n", "\"I have taken Tamoxifen for 5 years. Side effe... | \n", "Breast Cancer, Prevention\\n\"I have taken Tamox... | \n", "
53762 | \n", "Escitalopram | \n", "Anxiety | \n", "\"I've been taking Lexapro (escitaploprgra... | \n", "Anxiety\\n\"I've been taking Lexapro (escit... | \n", "
53763 | \n", "Levonorgestrel | \n", "Birth Control | \n", "\"I'm married, 34 years old and I have no ... | \n", "Birth Control\\n\"I'm married, 34 years old... | \n", "
53764 | \n", "Tapentadol | \n", "Pain | \n", "\"I was prescribed Nucynta for severe neck/shou... | \n", "Pain\\n\"I was prescribed Nucynta for severe nec... | \n", "
53765 | \n", "Arthrotec | \n", "Sciatica | \n", "\"It works!!!\" | \n", "Sciatica\\n\"It works!!!\" | \n", "
53471 rows × 4 columns
\n", "