You are on page 1of 2

import numpy as np

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

df=pd.read_csv("/kaggle/input/daramas-data/ARY.csv",encoding='cp1252')
df.head()

df.Posts.fillna("No posts",inplace=True)
df.head()

len(df)

df["char"]=df["Posts"].apply(len)
df.head()

df['words'] = df['Posts'].apply(lambda x:len(x.split()))


df.head()

df1=df.fillna(2)
df1.head()

import wordcloud
from wordcloud import WordCloud
mycloud = WordCloud(background_color="white").generate(str(df1))
plt.imshow(mycloud)

df_sort_by_likes=df1.sort_values(["Likes"],ascending=False)
df_sort_by_likes

sns.barplot(x="Posts",y="Likes",data=df1)

g=df1["Likes"].max()
h=df1["Likes"].min()
i=df1["Likes"].mean()
print(g)
print(h)
print(i)

plt.boxplot(df1.Likes)
plt.show()

df_sort_by_comments=df1.sort_values(["Comments"],ascending=False)
df_sort_by_comments

sns.barplot(x="Posts",y="Comments",data=df1)

gg=df["Comments"].max()
hh=df["Comments"].min()
ii=df["Comments"].mean()
print(gg)
print(hh)
print(ii)
df_sort_by_shares=df1.sort_values(["Shares"],ascending=False)
df_sort_by_shares

sns.barplot(x="Posts",y="Shares",data=df1)

ggg=df1["Shares"].max()
hhh=df1["Shares"].min()
iii=df1["Shares"].mean()
print(ggg)
print(hhh)
print(iii)

You might also like