在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
满意答案
使用pandas,避免将
NaN
与整数相结合除非你有充分的理由,否则请避免这种做法。 原因是
pandas
只允许在连续内存块中使用向量化计算。 这仅适用于相同类型的数据,例如一系列类型为int
,float
,datetime
,但不是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 integersUnless 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 typeint
,float
,datetime
, but notobject
.
NaN
is consideredfloat
. Therefore, combining integers withNaN
forcespandas
to, by default, upcast the entire series tofloat
. 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 withdtype=object
, and havepandas
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.
相关问答
更多将多个过滤器应用于大熊猫DataFrame或Series的高效方法(Efficient way to apply multiple filters to pandas DataFrame or Series)
使用浮动切片列表切片大熊猫系列(Slicing a pandas series using a list of float slices)
大熊猫系列累积argmax(pandas series cumulative argmax)
访问大熊猫系列timedeltas的`.days`(Accessing `.days` for a pandas Series of timedeltas)
pd.notnull的奇怪的空检查行为(Weird null checking behaviour by pd.notnull)
Pandas notnull不在数据框中的列上工作(Pandas notnull is not working on column in data frame)
大熊猫系列的功能组成(functional composition of pandas' Series)
大熊猫指定一个用notnull()过滤的系列,(Pandas Assigning back a series that was filtered with notnull())
我们应该总是使用@NotNull还是@Nullable?(Should we always use @NotNull or @Nullable?)
为什么我不能将事件标记为NotNull?(Why can't I mark an event as NotNull?)
相关文章
更多secureCRT使用VIM 像LINUX中那样对语法高亮
WebStorm安装Vim以及快捷键设置
ServletOutputStream cannot be resolved to a type
How to Start a Business in 10 Days
HTML 超链接(a标签、锚)
Become a Master Designer: Rule Three: Contrast, Contrast, Contrast
Securing Solr on Tomcat access using a user account
trouble is a friend
Becoming a data scientist
最新问答
更多sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)
如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)
AESGCM解密失败的MAC(AESGCM decryption failing with MAC)
Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)
湖北京山哪里有修平板计算机的
SimplePie问题(SimplePie Problem)
在不同的任务中,我们可以同时使用多少“上下文”?(How many 'context' we can use at a time simultaneously in different tasks?)
HTML / Javascript:从子目录启用文件夹访问(HTML/Javascript: Enabling folder access from a subdirectory)
为什么我会收到链接错误?(Why do I get a linker error?)
如何正确定义析构函数(How to properly define destructor)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!