OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Creating Treemap in Plotly Express for inflation data

  • Thread starter Thread starter user1953588
  • Start date Start date
U

user1953588

Guest
I'm struggling on how to create a treemap of inflation data. Its to do with the hierarchy data and parent data. I keep getting errors.

Code:
import pandas as pd
import plotly.express as px

# Read the data from the Excel file
df = pd.read_excel('UKCPI2.xlsx', engine='openpyxl')

# Create the treemap with the filtered data
fig = px.treemap(df, path=['parent', 'Series'], values='Contrib') # Ensure 'contrib' is the correct column name for your values
fig.show()

I keep getting errors

This is how the data is formatted
<p>I'm struggling on how to create a treemap of inflation data.
Its to do with the hierarchy data and parent data.
I keep getting errors.</p>
<pre><code>import pandas as pd
import plotly.express as px

# Read the data from the Excel file
df = pd.read_excel('UKCPI2.xlsx', engine='openpyxl')

# Create the treemap with the filtered data
fig = px.treemap(df, path=['parent', 'Series'], values='Contrib') # Ensure 'contrib' is the correct column name for your values
fig.show()
</code></pre>
<p>I keep getting errors</p>
<p><a href="https://i.sstatic.net/Qyz2p2nZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Qyz2p2nZ.png" alt="This is how the data is formatted" /></a></p>
 

Latest posts

I
Replies
0
Views
1
impact christian
I
Top