首页 \ 问答 \ 在数据框中为所有值添加一个(adding one to all the values in a dataframe)

在数据框中为所有值添加一个(adding one to all the values in a dataframe)

我有一个类似下面的数据框。 我想在每行的所有值中添加一个。 我是这个论坛和python的新手,所以我无法概念化如何做到这一点。 我需要为每个值添加1。 我打算使用贝叶斯概率,当我乘以它们时,后验概率将为0。 PS。 我也是概率新手,但其他人也采用了相同的方法。 感谢您的帮助。 我正在使用熊猫这样做。

Disease  Gene1  Gene2  Gene3 Gene4 
D1    0    0    25   0  
D2    0    0    0    0  
D3    0    17   0    16  
D4    24   0    0    0  
D5    0    0    0    0  
D6    0    32   0    11  
D7    0    0    0    0  
D8    4    0    0    0

I have a dataframe like the one below. I would like to add one to all of the values in each row. I am new to this forum and python so i can't conceptualise how to do this. I need to add 1 to each value. I intend to use bayes probability and the posterior probability will be 0 when i multiply them. PS. I am also new to probability but others have applied the same method. Thanks for your help in advance. I am using pandas to do this.

Disease  Gene1  Gene2  Gene3 Gene4 
D1    0    0    25   0  
D2    0    0    0    0  
D3    0    17   0    16  
D4    24   0    0    0  
D5    0    0    0    0  
D6    0    32   0    11  
D7    0    0    0    0  
D8    4    0    0    0

原文:https://stackoverflow.com/questions/30794525
更新时间:2023-10-03 07:10

最满意答案

<input type="text" value="">
<input type="text">

input[value]{
  background: #ccc;
}

亲自尝试https://jsfiddle.net/55rjf0y8/


<input type="text" value="">
<input type="text">

input[value]{
  background: #ccc;
}

Try it yourself https://jsfiddle.net/55rjf0y8/

相关问答

更多
  • 不,对于CSS选择器中的属性名称没有通配符。 所有属性选择器都约束一个属性的特定名称。 No, there is no wildcarding for attribute names in CSS selectors. All attribute selectors contrain a specific name of an attribute.
  • :last-of-type正在选择两者,因为你的2个元素的类型是文章 , 除此之外 ,我相信你使用的教程只使用相同类型的div 。 尝试使用[class*="col-"]:last-child如果你决定把文章放在一边。 :last-of-type is selecting both because the types of your 2 elements is article and aside, I believe the tutorial you are using uses only div whic ...
  • $.removeClass()不会将选择器作为参数,而只是一个类名(或类名)。 请参阅: 删除多个类(jQuery) 所以你基本上需要打电话: $.removeClass('ratingBlock1 ratingBlock2 ratingBlock3 ratingBlock4 ratingBlock5'); $.removeClass() doesn't take a selector as a parameter, only a class name (or class names). See: Rem ...
  • 实际上你的代码工作正常。 看这个:
    three
    three
    同 [id*="row"] .element {color: red} ..并注意到id与行是红色的。 小提琴 有关属性选择器的更多信息,请查看规范 如果我想知道为什么这不适合你,我会说这个问题与特异性有关。 为了检查这一点,右键单击其中 ...
  • 我认为这实际上取决于选择器的用途。 几乎每个站点都有一个或几个样式表可以“整理”站点 - 字体,文本颜色,链接颜色/悬停,行间距等等,并且您不希望这些选择器非常具体。 类似地,如果你有一个在许多页面中重复使用的组件或元素,并且总是需要看起来相同 - 比如让我们在这里说标签 - 那么如果你使用基于ID的选择器,那么维护是很痛苦的。 如果它引用特定页面上的特定元素,我总是在选择器中使用ID。 没有什么比试图弄清楚为什么你的规则似乎没有工作因为与其他规则的冲突更令人沮丧,如果一切都是类,这可能会发生很多。 另一方 ...
  • 如果样式只涉及一个唯一元素,则基于ID的选择器是最合适的。 如果一个样式可能涉及多个元素,请使用一个类。 另外要记住的是基于ID的选择器比基于类的选择器具有更高的优先级。 这有助于如果您的任何独特的ID'd元素继承了更通用的,基于分类的规则的样式。 If a style only refers to one, unique element, an ID based selector is the most appropriate. If a style may refer to multiple eleme ...
  • 类选择器比类型选择器更具体。 当您将类型选择器更改为类选择器时,第一个选择器仍具有优先权,因为它首先出现。 将第一个类选择器更改为类型选择器时,第二个选择器将变得更具体,并且优先。 A class selector is more specific than a type selector. When you change the type selector to a class selector, the first selector still has precedence, just because ...
  • input[value]{ background: #ccc; } 亲自尝试https://jsfiddle.net/55rjf0y8/ input[value]{ background: #ccc; } Try it yourself https://jsfiddle.net/55rjf0y8/
  • 这种风格应该在IE7 +上完美运行。 正如Pekka在评论中所说,IE6存在一个小问题 。 我猜你也许没有使用严格的doctype? 在这种情况下,你应得的一切:-o 只需将添加到HTML文件的开头,一切都应该没问题。 That style should work perfectly on IE7+. As Pekka said in the comments there is a small problem with IE6. I'm guessing that you're ...
  • 如果你封装字段名称它应该工作,试试这个: $messageElement = $crawler->filter('input[name="myField[0].thing"]'); return $messageElement->attr($attribute);. 对于奖金问题,您可以使用类似于此处建议的正则表达式匹配: CSS中的通配符*用于类 // For matching strings starting with a certain thing notice the ^= $messageEl ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)