Hello, I would like to use a image in exce by pytgon code. But, image is located at the local file in the computer? Is is possible
Access files on the local hard drive is not currently possible in Anaconda Code, nor in Python in Excel.
What are you trying to accomplish with the local image?
Hello, I would like to prepare a heatmap according to dataFrame. With jupiter notebook I can read the picture to use in code. I would like to prepare
heatmap at the data excel file.
code is like this
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
Görüntü yolu
image_path = r"C:\Users\AKARCA\Downloads\plant_layout.png"
img = mpimg.imread(image_path)
Excel dosyasını oku
tf_lists = pd.read_excel(
r’C:\Users\AKARCA\OneDrive - cam\Desktop\cam documents\data dosyaları\energy_consumption_data\raw sayac verileri\tf_list.xlsx’,
sheet_name=‘Sheet1’
)
x = tf_lists[‘X’]
y = tf_lists[‘Y’]
plt.figure(figsize=(12, 6))
plt.imshow(img, zorder=0, extent=[0, 3000, 0, 1200], aspect=‘auto’)
sns.kdeplot(x=x, y=y, cmap=“Reds”, fill=True, alpha=0.6, bw_adjust=0.5)
plt.xlim(0, 3000)
plt.ylim(0, 1200)
plt.xticks(range(0, 3100, 200))
plt.yticks(range(0, 1300, 100))
plt.grid(linestyle=“–”, alpha=0.5)
plt.show()