CJYen 3 rokov pred
commit
2f7200c0bb
4 zmenil súbory, kde vykonal 59 pridanie a 0 odobranie
  1. 9 0
      README.md
  2. 40 0
      api/main.py
  3. 10 0
      chart.html
  4. BIN
      result/img.jpg

+ 9 - 0
README.md

@@ -0,0 +1,9 @@
+### Required
+---
+- plotly
+- plotly_express
+- pandas
+
+### Result
+---
+![result](./result/img.jpg)

+ 40 - 0
api/main.py

@@ -0,0 +1,40 @@
+import plotly_express as px
+import pandas as pd
+import plotly
+
+# Read data from excel
+df = pd.read_csv("../docs/keyword.csv")
+keyword = df['Keyword']
+
+# competition = df['Competition (indexed value)']
+bid = df['Top of page bid (low range)']
+search = df['Avg_monthly_searches']
+margin = df['Top of page bid (low range)']
+remark = df['Keyword']
+
+
+# Create chart and store as figure [fig]
+fig = px.treemap(df,
+                 path=[keyword, bid],
+                 values=search,
+                 color=margin,
+                 # color_continuous_scale=['green', 'yellow', 'red'],
+                 color_continuous_scale=px.colors.sequential.Peach,
+                 title='Keyword Overview',
+                 hover_name=remark,
+                 )
+
+fig.update_traces(root_color="lightgrey")
+
+
+# Update/change layout
+fig.update_layout(title_font_size=42,
+                  title_font_family='Arial',
+                  margin=dict(t=50, l=25, r=25, b=25)
+                  )
+
+fig.show()
+
+
+# save chart and export to HTML
+plotly.offline.plot(fig, filename='../chart.html')

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 10 - 0
chart.html


BIN
result/img.jpg


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov