<jupyter_start><jupyter_text>Data Details<jupyter_code>data.info()
data.describe()
data.head()<jupyter_output><empty_output><jupyter_text>Preprocessing<jupyter_code>def checkfloat(data):
  try:
    float(data)
    return True
  except:
    return False
data.drop(['Product_url','Product_img','prod_des'],axis=1,inplace=True)
data.dropna(inplace=True)
data.Product_price=data.Product_price.apply(lambda x:x[1:].replace(',',''))
data=data[data.Product_price.apply(checkfloat)]
data.rating=data.rating.apply(lambda x:x.split(' ')[0].replace(',',''))
data=data[data.rating.apply(checkfloat)]
data.total_review=data.total_review.apply(lambda x:x.split(' ')[0].replace(',',''))
data.ans_ask=data.ans_ask.apply(lambda x:x.split(' ')[0].replace(',','') if (x.split(' ')[0][-1]!='+') else x.split(' ')[0][:-1].replace(',',''))
data['Prod_name']=data['Product_name'].apply(lambda x:re.split('[()]',x)[0])
data['Prod_details']=data['Product_name'].apply(lambda x: re.split('[()]',x)[1] if len(re.split('[()]',x))>1 else 'None')
data.drop('Product_name',axis=1,inplace=True)
data['cust_review_pol']=data.cust_review.apply(lambda x: TextBlob(x).sentiment.polarity)
data['cust_review_sub']=data.cust_review.apply(lambda x: TextBlob(x).sentiment.subjectivity)
data.drop('cust_review',axis=1,inplace=True)
cols=['Prod_name', 'Prod_details', 'by_info', 'Product_price', 'rating', 'total_review', 'ans_ask', 'feature', 'cust_review_pol', 'cust_review_sub']
data=data[cols]

floats=['Product_price', 'rating','cust_review_pol', 'cust_review_sub']
data[floats]=data[floats].astype(float)

ints=['total_review', 'ans_ask']
data[ints]=data[ints].astype(int)
data.shape<jupyter_output><empty_output><jupyter_text>Data Details<jupyter_code>data.info()
data.describe()
data.head()<jupyter_output><empty_output><jupyter_text>Column Details Prod_name : Product's Name Prod_details : Brief details about the product by_info : Product's Brand Product_price : Product's price rating : Product's overall customer rating total_review	 : Total no of customer reviews for that product ans_ask : No of questions answered feature : feature cust_review_pol : Polarity in Customer Reviews Polarity : lies between [-1,1], -1 defines a negative sentiment and 1 defines a positive sentiment. cust_review_sub : Subjectivity in Customer ReviewsSubjectivity : quantifies the amount of personal opinion and factual information contained in the text. The higher subjectivity means that the text contains personal opinion rather than factual information.  Save Dataset<jupyter_code>data.to_csv('Output.csv',index=False)<jupyter_output><empty_output><jupyter_text>Checking Saved Output.csv<jupyter_code>data_new=pd.read_csv('Output.csv')
data_new.head()<jupyter_output><empty_output><jupyter_text>Plotting<jupyter_code>top=data_new.by_info.value_counts().index
import matplotlib.pyplot as plt
%matplotlib inline

blist=['Samsung']

for i in blist:
  pltdata=data_new[data_new.by_info == i]
  plt.plot(pltdata.Prod_name,pltdata.ans_ask)
plt.xticks(rotation=90)
plt.legend(blist)
import matplotlib.pyplot as plt
%matplotlib inline

blist=['Samsung']

for i in blist:
  pltdata=data_new[data_new.by_info == i]
  plt.bar(pltdata.Prod_name,pltdata.ans_ask)
plt.xticks(rotation=90)
plt.legend(blist)
import matplotlib.pyplot as plt
%matplotlib inline

plt.bar(top[:10],data_aggre.loc[top[:10]].ans_ask)
plt.xticks(rotation=90)
plt.ylabel('ans_ask')
import matplotlib.pyplot as plt
%matplotlib inline

plt.bar(top[:10],data_aggre.loc[top[:10]].rating)
plt.xticks(rotation=90)
plt.ylabel('Rating')
import matplotlib.pyplot as plt
%matplotlib inline

plt.bar(top[:10],data_aggre.loc[top[:10]].Product_price)
plt.xticks(rotation=90)
plt.ylabel('Product_price')
import matplotlib.pyplot as plt
%matplotlib inline

plt.bar(top[:10],data_aggre.loc[top[:10]].cust_review_pol)
plt.xticks(rotation=90)
plt.ylabel('cust_review_pol	')
data_aggre=data_new.groupby(by='by_info').mean()
data_aggre.loc[top[:20]]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16112789526686808, 'fraction_numerical': 0.012084592145015106, 'mean_word_length': 9.032828282828282, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '370213', 'license': 'MIT', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1463, 'n_words': 236, 'path': 'Amzn.ipynb', 'repo_name': 'abasheer669/Amazon-Phone-Review', 'size': '3972'}