如何使用pysolr对solr进行原子更新?(How to make atomic updates to solr using pysolr?)
我找不到关于如何使用pysolr更新solr的文档。
I can't find a decent documentation on how to make updates to solr using pysolr.
原文:https://stackoverflow.com/questions/24415659
更新时间:2023-01-28 06:01
最满意答案
您可以使用
replace
字符.
使用sort_index
为float
:df.index = df['A'].str.replace('[a-zA-Z]+','.').astype(float) df = df.sort_index().reset_index(drop=True) print (df) A B 0 17 1 1 150 5 2 200b 4 3 286a1 2 4 286a2 0 5 373 3
You can use
replace
characters to.
with cast tofloat
withsort_index
:df.index = df['A'].str.replace('[a-zA-Z]+','.').astype(float) df = df.sort_index().reset_index(drop=True) print (df) A B 0 17 1 1 150 5 2 200b 4 3 286a1 2 4 286a2 0 5 373 3
相关问答
更多-
#被视为注释标志。 引用没有什么区别: In [345]: txt=b'''1,85,104,2,"C" ...: 2,71,82,2,"C#" ...: 3,67,73,2,"D" ...: 4,105,108,2,"D#" ...: 5,103,100,2,"E"''' In [346]: In [346]: np.genfromtxt(txt.splitlines(),delimiter=',',dtype=None) Out[346]: array([(1 ...
-
R中混合类型的变量(variable of mixed types in R)[2022-05-19]
一种方法是创建一个与任何文本字符分开的新矢量。 ## Create new vector without any characters col2 <- col[-grep("[a-zA-Z]", col)] ## To strip percentages (%) strip_percents <- as.numeric(gsub("%", "", col2)) ## All numbers except percentages no_percents <- as.numeric(col2[-grep(" ... -
我会做一个动态的解决方案而不是递归的解决方案,因为我不想冒险使用非确定性的递归调用数量来溢出堆栈。 func printArray(array: Array
) -> () { var dynamicCollection: Array = array dynamicCollection.unshare() do { let firstObject: AnyObject = dynamicCollection[0] ... -
我会使用Enumerable#grep做如下的操作: ar = [1, "cool", 3, "story", 4, "bro"] ar.grep(Fixnum).sort + ar.grep(String) # => [1, 3, 4, "cool", "story", "bro"] 如果您还想对字符串进行排序,请执行以下操作: ar = [1, "cool", 3, "story", 4, "bro"] ar.grep(Fixnum).sort + ar.grep(String).sort # => ...
-
是的,你是正确的,基恩可以接受不同类型的数据作为你的财产的价值。 Keen的宽松数据类型的一个例子是像VisitorID这样的属性可以同时包含数字(即14558)或字符串(即“14558”)。 这是来自Keen网站的文章,对于查看可以检查数据类型的位置很有用: https : //keen.io/docs/data-collection/data-modeling-guide-200/#check-for-data-type-mismatch Yes, you're correct, Keen can ac ...
-
这是违反直觉的,但range参数仅适用于接收器 。 另一个字符串的长度( compare:的参数compare:不受范围限制。 你的调用将@"th"减少到{0,2}范围,产生@"th" (即,这没有效果),然后将它与@"They"进行比较。 你会看到这个: NSComparisonResult comp = [@"They" compare:@"th" options:NSCaseInsensitiveSearch ...
-
a = [1, 23, 456, 6789] for i in map(str, a): for j in range(len(i)): print(i[j:]+i[:j]) 内置的函数map在python.org map有记录。 如果数字的顺序是相关的,那么做: import itertools a = [1, 23, 456, 6789] for i in map(str, a): for j in itertools.chain(range(1),range(len(i)-1,0,- ...
-
如果使用联合类型,则必须列出该联合类型中的所有可能的参数类型。 如果你说 函数接受字符串函数或对象(我可以使用重载为此),但它也接受像这样的混合值的数组 您可以为单个值定义类型别名,该值可以是字符串,函数或对象 type SingleArg = string | object | ((string, object) => void); 并定义一个采用一个SingleArg或数组的函数(您不需要有任何重载) function Terminal(interpreter: SingleArg | Single ...
-
你可以试试这样的东西(MYSQL)。 它使用用户定义的变量“生成”字段进行排序。 我想FIL是表的名称: SELECT ID, FILES, NR, STRING, TYPE FROM ( SELECT * , @o:= CASE WHEN TYPE='REQUEST' THEN @o+2 ELSE 0 END ord , @p:= CASE WHEN TYPE= 'RESPONSE' THEN @p+2 ELSE 0 END ord2 , @o+@p AS ord_tot ...
-
您可以使用replace字符. 使用sort_index为float : df.index = df['A'].str.replace('[a-zA-Z]+','.').astype(float) df = df.sort_index().reset_index(drop=True) print (df) A B 0 17 1 1 150 5 2 200b 4 3 286a1 2 4 286a2 0 5 373 3 You can use repla ...