I'm having a big data-set in that three columns are there from those three columns I have to group-by the data by first columns and using the frequency of the first columns I need to plot the Line graph and Density graph. There are 1600 values counted in this graph.
some set of data are
Search keyword Campaign ID total_ctr
"2 +bhk +flat +in +bangalore 653435194 0.00
"2 +bhk +flat +in +bangalore 653435194 0.00
"2 +bhk +flat +in +bangalore 653435194 0.00
"2 +bhk +flat +in +bangalore 653435194 0.00
"2 +bhk +flat +in +bangalore 653435194 0.00
"2 +bhk +flat +in +bangalore 653435194 0.00
"2 +bhk +flat +in +bangalore 653435194 0.00
"2 +bhk +flat +in +bangalore 653435194 0.00
"2 +bhk +flat +in +bangalore 653435194 15.38
"2 +bhk +flat +in +bangalore 653435194 0.00
"2 +bhk +flat +in +bangalore 653435194 0.0
+bedroom +apartment +in +bangalore 1155466985 0.00
+1 +bedroom +apartment +in +bangalore 1155466985 0.00
+1 +bedroom +apartment +in +bangalore 1155466985 0.00
+1 +bedroom +apartment +in +bangalore 1155466985 100.00
+1 +bedroom +apartment +in +bangalore 1155466985 0.00
+1 +bedroom +apartment +in +bangalore 1155466985 0.00
Like this the data set is goes for 22,200 lines and have 1600 search keyword have diffrent combination of total_ctr and campID.
some of thier frequency are
Campaign ID total_ctr
Search keyword
"2 +bhk +flat +in +bangalore 24 24
+1 +bhk +flat +in +bangalore 89 89
+1 +bhk +flat +near +manyata tech park 23 23
+1 +bhk +flat +price +in +bangalore 15 15
+1 +bhk +flat +sale +bangalore 9 9
+1 +bhk +flats +bangalore 52 52
+1 +bhk +for +sale +in +bangalore 76 76
+1 +bhk +house +for +sale +in +bangalore20 20
+1 +bhk +in +bangalore +sale 61 61
+1 +bhk +in +north +bangalore 36 36
+1 +bhk +near +airport 1 1
+1 +bhk +north +bangalore 8 8
+1bhk +apartment +in +bangalore 53 53
+1bhk +apartments +bangalore 9 9
+1bhk +bangalore 118 118
+1bhk +flat +bangalore 26 26
+1bhk +flats +bangalore 107 107
+1bhk +near +airport 4 4
+2 +3 +bhk +flats in +bangalore 50 50
From this frequency I want to plot 1600 plot in line and density graph
for i in df['Search keyword'].unique():
xxx = df[df['Search keyword']==i]['total_ctr']
jj =len(xxx)
if jj>>29:
print(jj)
plt.plot(xxx)
plt.title(i)
plt.show()
sns.kdeplot(xxx)
plt.title(i + 'density')
plt.show()
plt.savefig('books_read.pdf')
Think this will work on the Python pandas
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.