我想在两个不同的子图中绘制数据.绘图后,我想回到第一个子图并在其中绘制一个额外的数据集.但是,当我这样做时,我收到此警告:
MatplotlibDeprecationWarning:使用与先前轴相同的参数添加轴当前重用前一个实例.在将来的版本中,将始终创建并返回新实例.同时,通过将唯一标签传递给每个轴实例,可以抑制此警告,并确保将来的行为.warnings.warn(message,mplDeprecation,stacklevel = 1)
我可以用一段简单的代码重现它:
import matplotlib.pyplot as plt
import numpy as np
# Generate random data
data = np.random.rand(100)
# Plot in different subplots
plt.figure()
plt.subplot(1, 2, 1)
plt.plot(data)
plt.subplot(1, 2, 2)
plt.plot(data)
plt.subplot(1, 2, 1) # Warning occurs here
plt.plot(data + 1)
Run Code Online (Sandbox Code Playgroud)
有关如何避免此警告的任何想法?我使用matplotlib 2.1.0.看起来像这里一样的问题
我使用的是python 3.5和pyinstaller 3.1.1版.我已经指定了一个名为SCADAsync_spec.spec的.spec文件,如下所示:
block_cipher = None
a = Analysis(['SCADAsync.py'],
pathex=['C:\\repo\\analysis\\trunk\\source\\python\\functions', 'C:\\repo\\analysis\\trunk\\source\\python\\Executables'],
binaries=None,
datas=[('figs\\ROMO_icon.ico','figs'),('figs\\OpenFile2.gif','figs'),('figs\\ROMOWind_Logo2015_CMYK.png','figs')],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='SCADAsync',
debug=True,
strip=False,
upx=True,
console=True
)
Run Code Online (Sandbox Code Playgroud)
执行时工作正常
pyinstaller SCADAsync_spec.spec
Run Code Online (Sandbox Code Playgroud)
现在创建了两个大文件夹(dist和build),我希望将其存储在默认目录以外的其他位置.有谁知道如何在spec文件中设置这些文件夹的位置?我想保持命令行命令尽可能简单,即.exe应该只通过键入来构建
pyinstaller SCADAsync_spec.spec
Run Code Online (Sandbox Code Playgroud)
从Pyinstaller手册中,我似乎可以为spec文件指定名为'DISTPATH'和'workpath'的全局变量(https://pythonhosted.org/PyInstaller/spec-files.html).但我无法弄清楚如何做到这一点.
任何帮助将不胜感激!
缺口
我正在Windows 10机器上运行Python脚本.该脚本读取压缩数据文件,存储为.tar.gz,对其进行处理,然后读取下一个文件.以这种方式,它处理数千个文件.
我在windows10 PowerShell中运行scipt,并且 - 看似随机 - 我经常会收到以下错误:
有时这种情况发生在一天之后,有时已经过了几分钟.我选择"关闭程序",脚本终止.查看Windows事件查看器,我可以看到以下条目:
错误应用程序名称:python.exe,版本:3.6.2150.1013,时间戳:0x59c1326e错误模块名称:multiarray.cp36-win_amd64.pyd,版本:0.0.0.0,时间戳:0x59c3eeda异常代码:0xc0000005
有关如何避免此错误消息的任何想法?
我有一个(法语)数据集,如下所示:
time;col1;col2;col3
06.09.2017 05:30;329,02;5,7;259
06.09.2017 05:40;500,5;6,6;261
06.09.2017 05:50;521,73;6,7;266
06.09.2017 06:00;1 091,33;9,1;273
06.09.2017 06:10;1 262,43;10;285
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下命令读取它:
import pandas as pd
df=pd.read_csv("Example_dataset.csv",
index_col=0,
encoding='latin',
parse_dates=True,
dayfirst=True,
sep=';',
decimal=',',
thousands=' ')
Run Code Online (Sandbox Code Playgroud)
col2和col3被识别为float和integer,但col1不被识别为数字,因为那里有数千个分隔符.有没有简单的方法来阅读这个数据集?设置thousands=' '似乎不起作用:
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 5 entries, 2017-09-06 05:30:00 to 2017-09-06 06:10:00
Data columns (total 3 columns):
col1 5 non-null object
col2 5 non-null float64
col3 5 non-null int64
dtypes: float64(1), int64(1), object(1)
memory usage: 160.0+ bytes
Run Code Online (Sandbox Code Playgroud)
有什么建议?
python ×4
csv ×1
dataframe ×1
file ×1
matplotlib ×1
numpy ×1
pandas ×1
pyinstaller ×1
windows-10 ×1