- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
为了使 seaborn.pairplot()
正常工作,在 jupyter notebook 中执行了以下步骤。 /usr/local/lib/python2.7/site-packages/matplotlib/matplotlib/transforms.pyc
中的错误停止了该函数的工作。
以下是 python 库版本:
print(matplotlib.__version__, sns.__version__)
('1.5.1', '0.7.1')
读取了 iris 数据集的 csv
data = pandas.read_csv('iris.csv')
data_no_nans = data.dropna()
sns.pairplot(data_no_nans)
错误信息:
ValueError Traceback (most recent call last)
<ipython-input-4-001343d0343b> in <module>()
----> 1 sns.pairplot(data)
/usr/local/lib/python2.7/site-packages/seaborn/linearmodels.pyc in pairplot(data, hue, hue_order, palette, vars, x_vars, y_vars, kind, diag_kind, markers, size, aspect, dropna, plot_kws, diag_kws, grid_kws)
1588 hue_order=hue_order, palette=palette,
1589 diag_sharey=diag_sharey,
-> 1590 size=size, aspect=aspect, dropna=dropna, **grid_kws)
1591
1592 # Add the markers here as PairGrid has figured out how many levels of the
/usr/local/lib/python2.7/site-packages/seaborn/axisgrid.pyc in __init__(self, data, hue, hue_order, palette, hue_kws, vars, x_vars, y_vars, diag_sharey, size, aspect, despine, dropna)
1253 if despine:
1254 utils.despine(fig=fig)
-> 1255 fig.tight_layout()
1256
1257 def map(self, func, **kwargs):
/usr/local/lib/python2.7/site-packages/matplotlib/figure.pyc in tight_layout(self, renderer, pad, h_pad, w_pad, rect)
1752 renderer,
1753 pad=pad, h_pad=h_pad, w_pad=w_pad,
-> 1754 rect=rect)
1755
1756 self.subplots_adjust(**kwargs)
/usr/local/lib/python2.7/site-packages/matplotlib/tight_layout.pyc in get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, pad, h_pad, w_pad, rect)
347 subplot_list=subplot_list,
348 ax_bbox_list=ax_bbox_list,
--> 349 pad=pad, h_pad=h_pad, w_pad=w_pad)
350
351 if rect is not None:
/usr/local/lib/python2.7/site-packages/matplotlib/tight_layout.pyc in auto_adjust_subplotpars(fig, renderer, nrows_ncols, num1num2_list, subplot_list, ax_bbox_list, pad, h_pad, w_pad, rect)
126 tight_bbox_raw = union([ax.get_tightbbox(renderer) for ax in subplots])
127 tight_bbox = TransformedBbox(tight_bbox_raw,
--> 128 fig.transFigure.inverted())
129
130 row1, col1 = divmod(num1, cols)
/usr/local/lib/python2.7/site-packages/matplotlib/matplotlib/transforms.pyc in __init__(self, bbox, transform, **kwargs)
1080 msg = ("'transform' must be an instance of"
1081 " 'matplotlib.transform.Transform'")
-> 1082 raise ValueError(msg)
1083 if transform.input_dims != 2 or transform.output_dims != 2:
1084 msg = "The input and output dimensions of 'transform' must be 2"
ValueError: 'transform' must be an instance of 'matplotlib.transform.Transform'
Regplot 完美运行
sns.regplot(x="petal_length", y="petal_width", data=data)
编辑
我怀疑这与 matplotlib 的字体管理器出现故障有关。我从 ~/.cache/中删除了 fontconfig 和 spicy 目录,并收到一条新的错误消息:AttributeError: 'module' object has no attribute 'Locked'
AttributeError Traceback (most recent call last)
<ipython-input-3-001343d0343b> in <module>()
----> 1 sns.pairplot(data)
/usr/local/lib/python2.7/site-packages/seaborn/linearmodels.pyc in pairplot(data, hue, hue_order, palette, vars, x_vars, y_vars, kind, diag_kind, markers, size, aspect, dropna, plot_kws, diag_kws, grid_kws)
1588 hue_order=hue_order, palette=palette,
1589 diag_sharey=diag_sharey,
-> 1590 size=size, aspect=aspect, dropna=dropna, **grid_kws)
1591
1592 # Add the markers here as PairGrid has figured out how many levels of the
/usr/local/lib/python2.7/site-packages/seaborn/axisgrid.pyc in __init__(self, data, hue, hue_order, palette, hue_kws, vars, x_vars, y_vars, diag_sharey, size, aspect, despine, dropna)
1253 if despine:
1254 utils.despine(fig=fig)
-> 1255 fig.tight_layout()
1256
1257 def map(self, func, **kwargs):
/usr/local/lib/python2.7/site-packages/matplotlib/figure.pyc in tight_layout(self, renderer, pad, h_pad, w_pad, rect)
1737 """
1738
-> 1739 from .tight_layout import (get_renderer, get_tight_layout_figure,
1740 get_subplotspec_list)
1741
/usr/local/lib/python2.7/site-packages/matplotlib/tight_layout.py in <module>()
15 from matplotlib.transforms import TransformedBbox, Bbox
16
---> 17 from matplotlib.font_manager import FontProperties
18 rcParams = matplotlib.rcParams
19
/usr/local/lib/python2.7/site-packages/matplotlib/matplotlib/font_manager.py in <module>()
1448 verbose.report("Using fontManager instance from %s" % _fmcache)
1449 except:
-> 1450 _rebuild()
1451 else:
1452 _rebuild()
/usr/local/lib/python2.7/site-packages/matplotlib/matplotlib/font_manager.py in _rebuild()
1433
1434 if _fmcache:
-> 1435 with cbook.Locked(cachedir):
1436 json_dump(fontManager, _fmcache)
1437
AttributeError: 'module' object has no attribute 'Locked'
最佳答案
所以我现在要回答我自己的问题。
我通过使用 Macports 虚拟环境解决了这个问题
sudo port selfupdate
sudo port install python27
sudo port install py27-virtualenv
/opt/local/bin/virtualenv-2.7 $HOME/local/python/27
添加到 .bash_profile:
alias py27="source $HOME/local/python/27/bin/activate"
在终端中运行以设置虚拟环境并使用 pip 安装所需的包。
py27
which pip
$HOME/local/python/27/bin/pip
pip install ipython etc
奇怪的是自制软件安装出了问题,我想知道是否安装了任何冲突的包。
不确定是否相关,但这是我的 .bash_profile:
# some settings to prefer homebrew paths in case it exists:
if which -s brew ; then
PATH="/usr/local/bin:/usr/local/sbin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
这可能把事情搞砸了。
关于python - Seaborn OS X : seaborn. pairplot() ValueError: 'transform' must be an instance of 'matplotlib.transform.Transform',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38688881/
在几个 SO 的问题中,有这些行可以访问代码的父目录,例如os.path.join(os.path.dirname(__file__)) returns nothing和 os.path.join(o
我想用 Python 更改文件模式。 os 模块具有三个功能上看似相同的功能: os.chmod os.fchmod os.lchmod 这三个版本有什么区别? 最佳答案 chmod 用于更改路径指定
考虑: pipe_read, pipe_write = os.pipe() 现在,我想知道两件事: (1) 我有两个线程。如果我保证只有一个正在读取 os.read(pipe_read,n) 而另一个
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
让我们以硬盘驱动器/网络接口(interface)为例。它由多个进程共享。现在多个进程可能会向硬盘驱动器发出并发命令来读取数据。当数据可用时,内核如何知道哪个进程的数据已准备好?操作系统和硬盘驱动器之
嗨,我正在尝试编写像这样的原子写入函数...... with tempfile.NamedTemporaryFile(mode= "w", dir= target_directory) as f:
net.Conn接口(interface)提供了 SetTimeout 方法,我应该用 os.Timeout 检查返回的错误.但是我看不到在返回的 os.Error 上调用 os.Timeout 的方
我正在使用 os 模块在我的 Django 项目 settings.py 文件中具有相对路径。变量 SITE_ROOT 设置为 settings.py 文件的当前工作目录,然后用于引用同样位于同一目录
正如我们所知,Windows 接受 "\" 和 "/" 作为分隔符。但是在python中,使用的是"\"。例如,调用 os.path.join("foo","bar"),将返回 'foo\\bar'。
我有以下工作目录:/Users/jordan/Coding/Employer/code_base ,我想要获取绝对路径的文件位于 /Users/jordan/Coding/Employer/code_
在 Python 中,如果路径中包含“~”,我能否确定扩展的用户调用将是绝对路径? 例如,这个表达式是否总是为真? path = '~/.my_app' os.path.expanduser(path
我是 Django 项目的初学者。Django 项目的 settings.py 文件包含这两行: BASE_DIR = os.path.dirname(os.path.dirname(os.path.
我有一个旧 MAC OS 文件存储中的文件集合。我知道集合存在文件名/路径名问题。问题源于我认为在原始操作系统中呈现为破折号的路径中包含一个代码点,但 Windows 与代码点斗争,并且其中一个包含
Ubuntu怎么安装mac os x主题呢?下文小编将为大家分享ubuntu14.04安装mac os x主题教程,安装MAC OS X&
我有一个 Firefox OS 应用程序,我希望在该应用程序之外打开一个链接(该链接指向不同的站点,在应用程序中打开它会使应用程序在没有强制的情况下无法使用)。我怎么做? Related bug re
我想为 Firefox OS 编写我的应用程序.使用什么样的语言(如 Android 的 Java 和 iOS 的 Objective C++)和工具(如 Eclipse、Xcode)? 最佳答案 适
我正在尝试创建一个 Palm OS 应用程序,以每 X 分钟或几小时检查一次网站,并在有数据可用时提供通知。我知道这种事情可以在新的 Palm 上完成——例如,当应用程序不在顶部时,我的 Centro
我需要在 Firefox OS 中显示全屏图像。我有一个具有 qHD 分辨率(960x540 像素)的“峰值”开发预览手机。 如何确保我的应用程序在其他具有不同屏幕分辨率的 firefox-os 设备
我正在尝试在 Firefox OS 中安装一个新的语言环境,但我不确定我是否正确地按照这些步骤操作。 首先,我尝试使用 Mercurial 下载所需的语言环境:它对我不起作用,Mercurial 说访
我有这个shell脚本Test.sh: #! /bin/bash FILE_TO_CHECK="/Users/test/start.txt" EXIT=0 while [ $EXIT -eq 0 ];
我是一名优秀的程序员,十分优秀!