首页 \ 问答 \ 在vim中定义颜色变量(Defining a color variable in vim)

在vim中定义颜色变量(Defining a color variable in vim)

例如,当制作colorscheme时,如何将#40ffff定义为“UglyColor”(即作为变量)?

可能/不可能吗?


When, for example, making a colorscheme, how can one define #40ffff as "UglyColor" (i.e. as a variable) ?

Possible / not possible ?


原文:https://stackoverflow.com/questions/2444072
更新时间:2024-04-23 12:04

最满意答案

使用pandas,避免将NaN与整数相结合

除非你有充分的理由,否则请避免这种做法。 原因是pandas只允许在连续内存块中使用向量化计算。 这仅适用于相同类型的数据,例如一系列类型为intfloatdatetime ,但不是 object

NaN被认为是float 。 因此,将整数与NaN组合会强制将pandas强制转换为float整个系列。 这会增加内存使用量,但对于大多数使用情况不是问题。

如果你NaN和整数结合起来,你需要用dtype=object创建一个系列,并且让pandas使用一系列指针。 这是昂贵的计算和内存密集型。 除非你绝对必须,否则不要这样做。

但如果你只是......

在将非NaN元素转换为整数之前,您可以将一个序列转换为object

df['B'] = df['B'].astype(object)

如上所述,您要求pandas / numpy使用系列中每个项目的指针。 您也可以开始使用列表。


With pandas, avoid combining NaN with integers

Unless you have an extremely good reason, avoid this practice. The reason is pandas only allows vectorised computations with arrays in contiguous memory blocks. This is only possible with data of the same type, e.g. a series of type int, float, datetime, but not object.

NaN is considered float. Therefore, combining integers with NaN forces pandas to, by default, upcast the entire series to float. This increases memory usage, but for most use cases is not an issue.

If you wish to combine NaN with integers, you need to create a series with dtype=object, and have pandas work with a series of pointers. This is expensive computationally and memory-intensive. Do not do it unless you absolutely must.

But if you simply must...

You can convert a series to object before converting non-NaN elements to integers:

df['B'] = df['B'].astype(object)

As explained above, you are asking pandas / numpy to work with a pointer for each item in your series. You might as well start working with lists instead.

相关问答

更多

相关文章

更多

最新问答

更多
  • CSS修复容器和溢出元素(CSS Fix container and overflow elements)
  • SQL多个连接在与where子句相同的表上(SQL Multiple Joins on same table with where clause)
  • nginx 80端口反向代理多个域名,怎样隐藏端口的
  • xcode提醒样式,swift 3(xcode alert style, swift 3)
  • 在Chrome控制台中调试JavaScript(debugging javascript in Chrome console)
  • Javascript - 试图围绕自定义事件(Javascript - Trying to wrap my head around custom events)
  • 边栏链接不可点击(Sidebar links aren't clickable)
  • 使用recpatcha gem时如何显示其他表单错误?(How do I display other form errors when using the recpatcha gem?)
  • boost.python避免两次注册内部类,但仍然在python中公开(boost.python Avoid registering inner class twice but still expose in python)
  • Android 现在软件很少吗?以后会多起来吗
  • 如何在ActiveAdmin 0.5.0中为资源全局指定预先加载?(How to specify eager loading globally for a resource in ActiveAdmin 0.5.0?)
  • matlab代码为黄金比例持续分数(matlab code for golden ratio continued fraction)
  • Android浏览器触摸事件位置(Android browser touch event location)
  • 将cURL输出分配给Bash中的变量(Assign output to variable in Bash)
  • 我如何在MVC视图上没有时间获取当前日期(how i can get current date without time on MVC view)
  • sql连接函数(sql join of function)
  • 为什么在Xamarin Media插件中使用ImageSource.FromStream而不是FromFile?(Why use ImageSource.FromStream instead of FromFile in Xamarin Media plugin?)
  • 这段代码是否真的可以防止SQL注入?(Will this code actually work against SQL-injection? [duplicate])
  • 信阳方远计算机学校大专证被国家认可么
  • React / Rails AJAX POST请求返回404(React/Rails AJAX POST request returns 404)
  • Android与php服务器交互(Android interact with php server)
  • 自动刷新QTableWidget可能吗?(Refresh QTableWidget automatically possible?)
  • JVM / Compiler优化对象的未使用属性(optimization of unused properties of object by JVM / Compiler)
  • 插入表格时,乌克兰字符会更改为问号(Ukrainian character change to question mark when insert to table)
  • 在头文件中包含异常类(Including an exception class in a header file)
  • 完成c#中的执行后关闭sqlcmd(Close sqlcmd after finishing executing in c#)
  • 使用软导航栏正确检测屏幕尺寸(Detecting screensize correctly with soft navigation bar)
  • Typescript:从输入更新值(Typescript : update value from input)
  • 如何在执行某些行后仅在断点处停止?(How to only stop at a breakpoint after some line was executed?)
  • 以未定义的元素在JSON中循环(loop in JSON with undefined elements)