在数据框中为所有值添加一个(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
最满意答案
<input type="text" value=""> <input type="text"> input[value]{ background: #ccc; }
<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.
-
如何在外观语义标签上创建CSS属性通配符选择器?(How do I make a CSS attribute wildcard selector over look semantic tags?)[2022-05-21]
: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 ...
-
实际上你的代码工作正常。 看这个:threethree
-
CSS选择器样式(CSS Selector Style)[2023-01-25]
我认为这实际上取决于选择器的用途。 几乎每个站点都有一个或几个样式表可以“整理”站点 - 字体,文本颜色,链接颜色/悬停,行间距等等,并且您不希望这些选择器非常具体。 类似地,如果你有一个在许多页面中重复使用的组件或元素,并且总是需要看起来相同 - 比如让我们在这里说标签 - 那么如果你使用基于ID的选择器,那么维护是很痛苦的。 如果它引用特定页面上的特定元素,我总是在选择器中使用ID。 没有什么比试图弄清楚为什么你的规则似乎没有工作因为与其他规则的冲突更令人沮丧,如果一切都是类,这可能会发生很多。 另一方 ... -
CSS选择器样式?(CSS selector style?)[2022-01-14]
如果样式只涉及一个唯一元素,则基于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/
-
IE上的css选择器(css selector on IE)[2022-05-08]
这种风格应该在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 ... -
在symfony css选择器中转义特殊字符或使用通配符(Escaping special characters in symfony css selector or using wildcard)[2021-04-29]
如果你封装字段名称它应该工作,试试这个: $messageElement = $crawler->filter('input[name="myField[0].thing"]'); return $messageElement->attr($attribute);. 对于奖金问题,您可以使用类似于此处建议的正则表达式匹配: CSS中的通配符*用于类 // For matching strings starting with a certain thing notice the ^= $messageEl ...