"""
<a id="1.1"></a>
<h3 style="background-color:skyblue;font-family:newtimeroman;font-size:200%;text-align:center">Drug Recommendation System in Health Care Using Machine Learning</h3>


The remarkable technological advancements in the health care industry have improved recently for the betterment of patients’ life and providing better clinical decisions. Applications of machine learning and data mining can change the available data to valuable information that can be used for recommending appropriate drugs by analyzing symptoms of the disease. 

A machine learning approach for multi-disease with drug recommendation can be proposed to provide accurate drug recommendations for the patients suffering from various diseases. This approach generates appropriate recommendations for the patients suffering from cardiac, common cold, fever, obesity, optical, and ortho. Supervised machine learning approaches such as Support Vector Machine (SVM), Random Forest, Decision Tree, and K-nearest neighbors can be used for generating recommendations for patients.

https://www.springerprofessional.de/en/a-drug-recommendation-system-for-multi-disease-in-health-care-us/18279852

For obvious reasons, I can't follow that approach. Since I'm not a DS (and never be one) I just read the files and ran some code cells.
"""
"""
![](https://data-flair.training/blogs/wp-content/uploads/sites/2/2019/10/machine-learning-in-healthcare.jpg)data-flair.training
"""
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load

import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
import plotly.graph_objects as go
import plotly.offline as py
import plotly.express as px

# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))

# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All" 
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
df = pd.read_excel('/kaggle/input/medicine-recommendation/Medicine_description.xlsx')
df.head()
#Code by Savita Nair https://www.kaggle.com/savitanair/hr-analytics

print(f'Dataset has {len(df.Drug_Name.unique())} unique groups')
print('*'*20)
print(f'And the top 10 counts are :')
print(df.Drug_Name.value_counts().head(10))
print('*'*20)

c = df.Drug_Name.value_counts().head(10)
fig, ax = plt.subplots(1,1,figsize=(12,6))
ax.bar(c.index, c.values, width=0.8, color='y')
plt.xticks(rotation=45)
#Code by Savita Nair https://www.kaggle.com/savitanair/hr-analytics

print(f'Dataset has {len(df.Reason.unique())} unique groups')
print('*'*20)
print(f'And the top 10 counts are :')
print(df.Reason.value_counts().head(10))
print('*'*20)

c = df.Reason.value_counts().head(10)
fig, ax = plt.subplots(1,1,figsize=(12,6))
ax.bar(c.index, c.values, width=0.8, color='r')
plt.xticks(rotation=45)
#Code by Savita Nair https://www.kaggle.com/savitanair/hr-analytics

print(f'Dataset has {len(df.Description.unique())} unique names')
print('*'*20)
print(f'And the top 10 counts are :')
print(df.Description.value_counts().head(10))
print('*'*20)

c = df.Description.value_counts().head(10)
fig, ax = plt.subplots(1,1,figsize=(12,6))
ax.bar(c.index, c.values, width=0.8, color='b')
plt.xticks(rotation=45)
#Code by Mohammad Imran Shaikh https://www.kaggle.com/shikhnu/covid19-tweets-eda-visualization-wordcloud

unique_df = pd.DataFrame()
unique_df['Features'] = df.columns
unique=[]
for i in df.columns:
    unique.append(df[i].nunique())
unique_df['Uniques'] = unique

f, ax = plt.subplots(1,1, figsize=(15,7))

splot = sns.barplot(x=unique_df['Features'], y=unique_df['Uniques'], alpha=0.8)
for p in splot.patches:
    splot.annotate(format(p.get_height(), '.0f'), (p.get_x() + p.get_width() / 2., p.get_height()), ha = 'center',
                   va = 'center', xytext = (0, 9), textcoords = 'offset points')
plt.title('Bar plot for number of unique values in each column',weight='bold', size=15)
plt.ylabel('#Unique values', size=12, weight='bold')
plt.xlabel('Features', size=12, weight='bold')
plt.xticks(rotation=90)
plt.show()
#word cloud
from wordcloud import WordCloud, ImageColorGenerator
text = " ".join(str(each) for each in df.Reason)
# Create and generate a word cloud image:
wordcloud = WordCloud(max_words=200,colormap='Reds', background_color="black").generate(text)
plt.figure(figsize=(10,6))
plt.figure(figsize=(15,10))
# Display the generated image:
plt.imshow(wordcloud, interpolation='Bilinear')
plt.axis("off")
plt.figure(1,figsize=(12, 12))
plt.show()
df1 = pd.read_excel('/kaggle/input/medicine-recommendation/Ratings.xlsx')
df1.head()
df1 = df1.rename(columns={'Short-form':'form'})
#Code by Siti K https://www.kaggle.com/khotijahs1/2020-indonesia-university-rank/comments

#20 Medicine by Rating
top_medicine = df1.sort_values(by='Rating', ascending=False)[:20]
figure = plt.figure(figsize=(10,6))
sns.barplot(y=top_medicine.form, x=top_medicine.Rating)
plt.xticks()
plt.xlabel('Medicine Rating')
plt.ylabel('Short-form')
plt.title('20 Medicines by Rating')
plt.show()
df2 = pd.read_excel('/kaggle/input/medicine-recommendation/Company_Name.xlsx')
df2.head()
df2.columns.tolist()
#Codes by Pooja Jain https://www.kaggle.com/jainpooja/av-guided-hackathon-predict-youtube-likes/notebook

text_cols = ['Company_Name','NSE_Symbol', 'Industry']

from wordcloud import WordCloud, STOPWORDS

wc = WordCloud(stopwords = set(list(STOPWORDS) + ['|']), random_state = 42)
fig, axes = plt.subplots(2, 2, figsize=(20, 12))
axes = [ax for axes_row in axes for ax in axes_row]

for i, c in enumerate(text_cols):
  op = wc.generate(str(df2[c]))
  _ = axes[i].imshow(op)
  _ = axes[i].set_title(c.upper(), fontsize=24)
  _ = axes[i].axis('off')

_ = fig.delaxes(axes[3])
s = (df2.isna().sum()/df2.shape[0]*100)<50
df2_modified = df2[s.index[s].tolist()]
print (df2_modified.shape)
df2_modified.head()
plt.rcParams['font.size'] = 14
fig, ax = plt.subplots(2, 2, figsize=(20,20))
for col, ax in zip(['Company_Name','NSE_Symbol','Rating', 'Industry'], ax.flat):
    dict_ = df2_modified[col].value_counts().head(10).to_dict()
    if ('Not Available' in dict_.keys()):
        dict_.pop('Not Available')
    labels = []
    for i in dict_.keys():
        i = i.split(' ')
        if (len(i) > 6):
            i[math.ceil(len(i)/2)-1] += '\n'
            labels.append(' '.join(i))
        else:
            labels.append(' '.join(i))
    ax.pie(x=list(dict_.values()), labels=labels, shadow=True, startangle=0)
    
    col = (' '.join(col.split('_'))).upper()
    ax.set_title(col, weight='bold', fontsize=18)
plt.tight_layout()
plt.show()
#Code by Olga Belitskaya https://www.kaggle.com/olgabelitskaya/sequential-data/comments
from IPython.display import display,HTML
c1,c2,f1,f2,fs1,fs2=\
'#eb3434','#eb3446','Akronim','Smokum',30,15
def dhtml(string,fontcolor=c1,font=f1,fontsize=fs1):
    display(HTML("""<style>
    @import 'https://fonts.googleapis.com/css?family="""\
    +font+"""&effect=3d-float';</style>
    <h1 class='font-effect-3d-float' style='font-family:"""+\
    font+"""; color:"""+fontcolor+"""; font-size:"""+\
    str(fontsize)+"""px;'>%s</h1>"""%string))
    
    
dhtml('Be patient. Marília Prata, @mpwolke was Here.' )