选择在python exec文件中导入CSV文档

我和我的团队刚刚制作了一个用Python编写的基本可执行文件,您可以在其中选择使用同一数据框显示不同类型的图。 我们希望将我们的项目带到下一步,即制作一个名为“导入CSV文件”的附加选项卡,该选项卡使用户可以导入所需的文件并基于该文件进行绘图。 我们仍然是初学者,并正在寻找有关查找位置的指南,以实现这一目标。

GUI如下所示:

enter image description here

还有一些用于定义绘图的代码

def BarChart():
df = pd.read_csv(r"G:\Python Programming\Workspace\Example.csv")
plt.style.use('ggplot')
x = df['Gross Production per stage (m3/day)'].head(12)
y = df['Proppant Pumped(t)'].head(12)
width = 0.25
mean = df['Gross Production per stage (m3/day)'].mean()
median = df['Proppant Pumped(t)'].median()
day = [1,2,3,4,5,6,7,8,9,10,11,12]
day = np.arange(len(day))
plt.bar(day,x,width = width,color = 'steelblue',linewidth=1.5,linestyle = '--',label = 'Gross Production per stage (m3/day)')
plt.xlabel('Day')
plt.title('Boldesti 98 well')
plt.axhline(mean,color='steelblue',linestyle='--',alpha = 0.60,label = 'The average gross production per stage')
plt.bar(day + width,y,color = '#444444',label = 'Proppant Pumped (t)')
plt.legend()
plt.grid(True)
plt.savefig('plot.png')
plt.show()

我们想到的是创建一种算法,当导入CSV文件时,该算法会自动使用新代码更改代码中整个图的数据框的目录路径。 例如df=pd.read_csv(r" new path\File.csv")

我们非常感谢您的帮助。

相关文章

功能概要:(目前已实现功能)公共展示部分:1.网站首页展示...
大体上把Python中的数据类型分为如下几类: Number(数字) ...
开发之前第一步,就是构造整个的项目结构。这就好比作一幅画...
源码编译方式安装Apache首先下载Apache源码压缩包,地址为ht...
前面说完了此项目的创建及数据模型设计的过程。如果未看过,...
python中常用的写爬虫的库有urllib2、requests,对于大多数比...