Dec-13-2018, 11:15 AM
creating this thread for students at loddi python school.
my_minmax_scaler = preprocessing.MinMaxScaler() my_minmax_scaler.fit(X[:, :3]) my_minmax_scaler.transform(X[:, :3]).max(axis=0)
creating this thread for students at loddi python school.
my_minmax_scaler = preprocessing.MinMaxScaler() my_minmax_scaler.fit(X[:, :3]) my_minmax_scaler.transform(X[:, :3]).max(axis=0)
(Dec-13-2018, 11:01 PM)micseydel Wrote: [ -> ]Did you have a question?hi, not yet, thx. created this thread for a school project.
scores1 = [] for k in range (1, 10): kmeans = KMeans(n_clusters= k).fit(X2) score = kmeans.score(X2) scores1.append((k,score))
#creating verified & non verified user df df_unverified = df[df['verified']==False] df_verified = df[df['verified']==True] #creating verified & non verified user sentiment analyses import seaborn as sns df['sentiment'] = df_unverified['Text1'].apply(lambda tweet: TextBlob(tweet).sentiment.polarity) df['sentiment']=df['sentiment'].astype('float') positive = df[df['sentiment']>0].count().astype(int) negative = df[df['sentiment']<0].count().astype(int) neutral = df[df['sentiment']==0].count().astype(int) labels= ['positive','neutral','negative'] sizes = [positive[0],neutral[0],negative[0]] colors=['lightgreen','grey','orange'] patches, texts, poop = plt.pie(sizes, colors=colors, startangle=90, autopct='%1.0f%%') plt.legend(patches, labels, loc="best") plt.title("How unverified users are reacting on #brexit by analyzing " + str(positive[0]+negative[0]+neutral[0]) + " tweets.") plt.axis('equal') plt.show() plt.savefig('sentiment_analysis_unverified_users') df['sentiment'] = df_verified['Text1'].apply(lambda tweet: TextBlob(tweet).sentiment.polarity) df['sentiment']=df['sentiment'].astype('float') positive = df[df['sentiment']>0].count().astype(int) negative = df[df['sentiment']<0].count().astype(int) neutral = df[df['sentiment']==0].count().astype(int) labels= ['positive','neutral','negative'] sizes = [positive[0],neutral[0],negative[0]] colors=['lightgreen','grey','orange'] patches, texts, poop = plt.pie(sizes, colors=colors, startangle=90, autopct='%1.0f%%') plt.legend(patches, labels, loc="best") plt.title("How verified users are reacting on #brexit by analyzing " + str(positive[0]+negative[0]+neutral[0]) + " tweets.") plt.axis('equal') plt.show() plt.savefig('sentiment_analysis_verified_users')