- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我很难尝试在 mac osx 上使用 python、numpy 和 matplotlib 绘制直方图。我在 6 个月前完美地运行了这个但是相同的代码产生了这个错误:
In [1]: %matplotlib inline
In [2]:import numpy as np
from numpy.random import randn
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy import stats
data = randn(75)
plt.hist(data)
返回以下信息:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-fa104aadeee7> in <module>()
8
9 data = randn(75)
---> 10 plt.hist(data,bins=20, density=True)
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.pyc in hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, hold, **kwargs)
2339 ax.hold(hold)
2340 try:
-> 2341 ret = ax.hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, **kwargs)
2342 draw_if_interactive()
2343 finally:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/axes.pyc in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, **kwargs)
7734 # this will automatically overwrite bins,
7735 # so that each histogram uses the same bins
-> 7736 m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs)
7737 if normed:
7738 db = np.diff(bins)
TypeError: histogram() got an unexpected keyword argument 'new''
我尝试卸载并重新安装 python、ipython、numpy、matplotlib 和 scipy,并将它们安装在 /usr/local/bin
中,但错误仍然存在。
有没有人以前见过这个问题或者知道可能的解决方案?谢谢
最佳答案
对我来说,cphlewis 的评论是我需要的提示。我当时使用的是 matplotlib 1.1,在更新到 1.5 后一切正常。
关于python - 类型错误 : histogram() got an unexpected keyword argument 'new' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29842264/
我正在尝试找出这两个部分之间的区别,这似乎与 question 重复,但那里给出的答案并没有解释很多,所以我想要一个更详细和简洁的解释。 最佳答案 拆分是出于安全原因。默认情况下(过去仅在 -Wl,-
ELF 格式的 .got 和 .got.plt 部分有什么区别? 最佳答案 我之前的评论是对的: I think .got is for relocations regarding global 'v
我知道在典型的 ELF 二进制文件中,函数是通过过程链接表 (PLT) 调用的。函数的 PLT 条目通常包含到全局偏移表 (GOT) 条目的跳转。该条目将首先引用一些代码以将实际函数地址加载到 GOT
我知道在典型的 ELF 二进制文件中,函数是通过过程链接表 (PLT) 调用的。函数的 PLT 条目通常包含到全局偏移表 (GOT) 条目的跳转。该条目将首先引用一些代码以将实际函数地址加载到 GOT
我对 SICP 1.37 的迭代解决方案是 (define (con-frac n d k) (define (iter i result) (if (= 1 i) res
我正在尝试开始部署,但收到此错误 error: error validating "httpd-basic-deployment.yaml": error validating data: Valid
获取错误 ORA-00932: inconsistent datatypes: expected CHAR got NUMBER 00932. 00000 - "inconsistent dataty
我在没有全局偏移表的情况下编译多个 PIC 文件时遇到问题。 使用以下参数编译第一个文件 onefile.c 时,程序集不包含对 GOT 的引用: arm-none-eabi-gcc.exe firs
Your smiling at me is my daily dose of magic. 你嫣然的微笑是我每日享受到的魅力。 you hold a piece of me no matte
我是 Twilio 的新手。我正在尝试使用本教程将 SMS 转发到电子邮件地址: https://www.twilio.com/blog/2017/07/forward-incoming-sms-me
谁能帮我在 GWT 上创建离线 map ,我听说过 OpenLayers,但我没有找到任何源代码,你对此有什么想法吗?谢谢。 最佳答案 您将需要GWT-Openlayers Wrapper对于 Ope
我正在处理一些在编译为 PIC(位置无关代码)时速度变慢 70-80% 的代码,并且正在寻找缓解问题的方法。问题的很大一部分是 gcc 坚持在每个函数中插入以下内容: call __i686.get_
我编写了一个自定义 hamcrest 匹配器,用于检查列表中的文件是否已被复制。该列表可能很长(1000 个以上文件),因此如果缺少一个文件,我不希望匹配器打印出整个列表。 我可以为丢失的文件进行自定
我的意思是在模块中定义的非静态全局变量,而不是在外部。 为什么一定要通过GOT引用呢?为什么不使用相对地址?(因为.data 段中的全局变量和.text 段中的引用之间的距离是一个常量,它也是位置无关
当我在阅读时 http://eli.thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries/#id
某些特定于平台的功能(例如 SSE 或 AVX)的可用性可以在运行时确定,如果不想为不同的功能编译和发布不同的对象,这将非常有用。 例如,以下代码允许我检查 AVX 并使用 gcc 进行编译,它提供了
我如何检查互联网连接是否成功(Wifi/3G/其他) 如果用户没有 Wifi 连接,我已经向用户显示错误,但我如何才能确保用户确实获得了 3G 连接如果他们希望在没有 Wifi 连接的情况下连接使用应
这是示例程序集文件,test.s .global main main: mov __progname@GOT, %eax // failed to compile mov __
mysqldump:得到错误:1449:使用锁表时指定为定义者的用户('root'@'192.200.1.16')不存在 请给出上述错误的解决方案。 最佳答案 最好使用第一个mysqldump和--s
前言:本篇为笔者学习极客时间《深入浅出计算机组成》过程中的部分疑问和解疑记录,因为这一块问题笔者学习过程中搜索所得答案较少,故留此博客。 1. 编译、链接和加载 我们知道,“C 语言代码 - 汇编代码
我是一名优秀的程序员,十分优秀!