Skip to content

Instantly share code, notes, and snippets.

@tommyhuang1
tommyhuang1 / Feature Importance
Created March 13, 2017 14:40
Feature Importance
n1 = NewData[['bathrooms','bedrooms','price',"By Owner",
"Exclusive",
"Sublet / Lease-Break",
"No Fee",
"Reduced Fee",
"Short Term Allowed",
"Furnished",
"Laundry In Unit",
"Private Outdoor Space",
"Parking Space",
@tommyhuang1
tommyhuang1 / Pregabalin Scatter Plot
Created February 12, 2017 22:29
Pregabalin Scatter Plot
wikiD = map(lambda x: TextBlob(x),DataWithRating3.Review)
resultD=[]
for i in range(len(wikiD)):
k = wikiD[i].sentiment.polarity
resultD.append(k)
DataWithRating3['Polarity'] = resultD
import seaborn as sns
@tommyhuang1
tommyhuang1 / Topiramate Scatter Plot
Created February 12, 2017 22:28
Topiramate Scatter Plot
wikiC = map(lambda x: TextBlob(x),DataWithRating2.Review)
resultC=[]
for i in range(len(wikiC)):
k = wikiC[i].sentiment.polarity
resultC.append(k)
DataWithRating2['Polarity'] = resultC
import seaborn as sns
@tommyhuang1
tommyhuang1 / Clonazepam Scatter Plot
Created February 12, 2017 22:25
Clonazepam Scatter Plot
wikiB = map(lambda x: TextBlob(x),DataWithRating1.Review)
resultB=[]
for i in range(len(wikiB)):
k = wikiB[i].sentiment.polarity
resultB.append(k)
DataWithRating1['Polarity'] = resultB
@tommyhuang1
tommyhuang1 / Gabapentin Scatter Plot
Created February 12, 2017 22:23
Gabapentin Scatter Plot
import sys
import numpy as np
reload(sys)
sys.setdefaultencoding('utf8')
from textblob import TextBlob
wikiA = map(lambda x: TextBlob(x),DataWithRating.Review)
resultA=[]
for i in range(len(wikiA)):
@tommyhuang1
tommyhuang1 / Review Subjectivity
Last active February 12, 2017 22:21
Review Subjectivity
result1=[]
for i in range(len(wiki)):
objective = wiki[i].sentiment.subjectivity
result1.append(objective)
result3=[]
for i in range(len(wiki1)):
objective = wiki1[i].sentiment.subjectivity
result3.append(objective)
@tommyhuang1
tommyhuang1 / Review Polarity
Created February 12, 2017 21:46
Review Polarity
# Polarity for Gabapentin
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from textblob import TextBlob
wiki = map(lambda x: TextBlob(x),B.Review)
result=[]
for i in range(len(wiki)):
@tommyhuang1
tommyhuang1 / Pregabalin Word Cloud
Created February 12, 2017 20:38
Pregabalin Word Cloud
from os import path
import PIL
import matplotlib.pyplot as plt
from wordcloud import WordCloud
n = Pregabalin.Review.str.cat(sep=', ')
wordcloud = WordCloud().generate(n)
# Open a plot of the generated image.
plt.imshow(wordcloud)
plt.axis("off");
plt.show()
@tommyhuang1
tommyhuang1 / Topiramate Word Cloud
Created February 12, 2017 20:34
Topiramate Word Cloud
n = Topiramate.Review.str.cat(sep=', ')
wordcloud = WordCloud().generate(n)
# Open a plot of the generated image.
plt.imshow(wordcloud)
plt.axis("off");
plt.show()
@tommyhuang1
tommyhuang1 / Clonazepam WordCloud
Created February 12, 2017 20:32
Clonazepam Word Cloud
k = clonazepam.Review.str.cat(sep=', ')
wordcloud = WordCloud().generate(k)
# Open a plot of the generated image.
plt.imshow(wordcloud)
plt.axis("off");
plt.show()