首页 \ 问答 \ 我的numpy数组总是以零结尾?(My numpy array always ends in zero?)

我的numpy数组总是以零结尾?(My numpy array always ends in zero?)

我想我错过了某个地方。 我使用两个for循环(x和y)和一个基于x,y位置的函数填充了一个numpy数组。 唯一的问题是,无论数组的大小如何,数组的值总是以零结尾。

thetamap = numpy.zeros(36, dtype=float)
thetamap.shape = (6, 6)
for y in range(0,5):
    for x in range(0,5):
        thetamap[x][y] =  x+y
print thetamap

I think I missed something somewhere. I filled a numpy array using two for loops (x and y) and a function based on the x,y position. The only problem is that the value of the array always ends in zero irregardless of the size of the array.

thetamap = numpy.zeros(36, dtype=float)
thetamap.shape = (6, 6)
for y in range(0,5):
    for x in range(0,5):
        thetamap[x][y] =  x+y
print thetamap

原文:https://stackoverflow.com/questions/15329557
更新时间:2023-10-13 16:10

最满意答案

使用:

wincmd k

我得到了我需要的东西


Using:

wincmd k

I got what I needed

相关问答

更多
  • 使用: wincmd k 我得到了我需要的东西 Using: wincmd k I got what I needed
  • 如果你让他们垂直地分开Cw J来移动一个到底部 如果你把它们分开水平地移动一个向右移动 要在分割窗口的“列”或“行”中旋转, Cw Cr 以下命令可用于更改窗口布局。 例如,当有两个垂直分割窗口时,CTRL-W K将在水平拆分窗口中更改。 相反,CTRL-W H也是这样。 If you have them split vertically C-wJ to move one to the bottom If you have them split horizontally C-wL to move one t ...
  • 看起来你的Vim是以简单的模式启动的。 看:help easy 当使用-y参数或evim调用Vim时,会发生这种情况,或者您可能在.vimrc配置中存在:set insertmode 。 找到源并禁用它; 暂时还可以通过Ctrl + O完成 :set noim Enter 。 Looks like your Vim is launched in easy mode. See :help easy. This happens when Vim is invoked with the -y argument o ...
  • ST2的Ctrl + P最接近的等价物(“最接近”而不是“精确”)是一个称为“插件”的插件。 还有其他类似的插件,如Command-T或FuzzyFinder 。 我使用CtrlP,我喜欢它,但我衷心地支持你的决定去“无插件”。 这不是最简单的方法,但从长远来看将会有所回报。 打开文件 打开文件的最基本的方法是:e /path/to/filename 。 幸运的是,你得到标签完成和通配符:经典*和一个特殊的** ,代表“任何子目录”。 结合所有这些,你可以做: :e **/*foo 从工作目录下 ...
  • 综上所述 有几种方法可以做到这一点,其中大多数都是建议的,但是我以为我会用两个额外的方法来总结: 每个目录vimrc - 有一个缺点,Vim必须在正确的目录启动:如果你的项目在~/project1 ,你有~/project1/.vim.custom和做~/project1/.vim.custom cd ~ ; vim project1/file.c cd ~ ; vim project1/file.c ,将不会找到自定义设置。 模型 - 非常有效,但有缺点,需要将它们添加到所有文件(并记住将它们添加到新文件 ...
  • 我已经使用Wincent Colaiuta的Command-T vim插件几个月了。 Wincent写了C中需要很快的部分,我必须说这是! 而且,我认为它的文件模式匹配逻辑甚至比Textmate的Command-T更好。 查看屏幕录像 。 VIM的Command-T插件提供了一种非常快速,直观的机制,以最少的击键打开文件。 它被命名为“Command-T”,因为它受到TextMate中绑定到Command-T的“Go to File”窗口的启发。 通过键入出现在其路径中的字符来选择文件,并通过一种算法进行排 ...
  • 如果你只在getWindowHandles()中看到2个窗口,那么弹出窗口可能是一个iframe。 在这种情况下,使用driver.switchTo()。frame()将焦点切换到该帧,而不是寻找一个全新的窗口。 这是关于切换方法的文档: http : //selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebDriver.html#switchTo() If you're only seeing 2 window in getWi ...
  • 来自:help :normal > :norm[al][!] {commands} *:norm* *:normal* (...) {commands} should be a complete command. If {commands} does not finish a command, the last one will be aborted as if or ...
  • 首先,使用set eventignore=all测试此行为。 如果问题得到解决,请尝试切换到scp缓冲区使用(确保你没有设置eventignore) debug buffer scp-buffer-name或debug wincmd p (取决于你何时看到问题),它将打开调试模式,你会能够看到它正在执行的所有自动命令(使用s[tep]或n[ext]移动到下一个命令,请参阅:h >next和:h >step以获取更多详细信息)。 First, test this behavior with set event ...
  • 你有两个Vim实例,第二个将第一个放在后台。 您需要使用shell的作业控制命令: to suspend the current job fg to switch to the latest background job fg2 to switch to the second latest background job jobs to list all current jobs 在您的情况下,单个将暂停第二个Vim并显示第一个。 另一个将暂停第一个Vim并让你回到你 ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)