Python Forum
Adding a subroutine to a larger program
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding a subroutine to a larger program
#2
I thought of modifying the code that I posted. to something like this:

import pandas as pd
import matplotlib.pyplot as plt

# Load the data 
data = ext.sort.values(['extratrees'], ascending=True)

# Extract the feature names and importance values
feature_names = range(0,51)
importances = data[0]

# Plot the data
plt.figure(figsize=(10, 5))
plt.title("Feature Importance")
plt.bar(feature_names, importances)
plt.xlabel("Sensor Index")
plt.ylabel("Importance Value")
plt.show()
But that seems very awkward. So, I hope there is an easier way.

Any help appreciated.

Respectfully,

Led_Zeppilin
Reply


Messages In This Thread
RE: Adding a subroutine to a larger program - by Led_Zeppelin - Jan-18-2023, 05:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  An unexplainable error in .format statement - but only in a larger piece of code? ToniE 4 807 Sep-05-2023, 12:50 PM
Last Post: ToniE
  Adding markers to Folium map only adding last element. tantony 0 2,208 Oct-16-2019, 03:28 PM
Last Post: tantony
  keypad loops/subroutine help arbrunso 1 3,107 Jul-18-2018, 09:39 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020