我尝试通过 os.environ 应用它,如下所示:
import os
import pandas as pd
os.environ["FILE"] = "File001"
df = pd.read_csv('/path/$FILErawdata.csv/')
Run Code Online (Sandbox Code Playgroud)
但熊猫不承认$FILE,而是给我$FILErawdata.csv not found
有没有其他方法可以做到这一点?
我目前有 2 个使用 seaborn 的子图:
import matplotlib.pyplot as plt
import seaborn.apionly as sns
f, (ax1, ax2) = plt.subplots(2, sharex=True)
sns.distplot(df['Difference'].values, ax=ax1) #array, top subplot
sns.boxplot(df['Difference'].values, ax=ax2, width=.4) #bottom subplot
sns.stripplot([cimin, cimax], color='r', marker='d') #overlay confidence intervals over boxplot
ax1.set_ylabel('Relative Frequency') #label only the top subplot
plt.xlabel('Difference')
plt.show()
Run Code Online (Sandbox Code Playgroud)
这是输出:
我对如何使 ax2(下图)相对于 ax1(上图)变得更短感到困惑。我正在查看 GridSpec ( http://matplotlib.org/users/gridspec.html ) 文档,但我不知道如何将它应用于 seaborn 对象。
题:
感谢您的时间。