I want to "fill" between two extended line.new. pine-script is not having it ;√) - line

[pine-script] "Fill," between two extended lines? line.new(bar_index[3], LAG_SHORT_CNT, & line.new(bar_index[3], LAG_SHORT_CNT7

Unfortunately this is not possible with the current version of pinescript, maybe in the future. For now you can only use fill() with either plot() or hline().

You can use plot() instead. Draw the lines with condition:
plot_line1 = plot(condition_01 ? line_01 : na)
plot_line2 = plot(condition_02 ? line_02 : na)
fill(plot_line1, plot_line2)

Related

Remove elements from a list in karate?

after using scripAll() to get list of style attribute values, I need to eliminate a few. Wanted to know if there is something like remove() in python which can be used for the same.
Example:
* def list_colors = ["rgb(245,60,86)", "rgb(245,60,86)", "rgb(245,00,00)", "rgb(245,00,00)" ]
Want to remove rgb(245,00,00) from the list. How can I do this in karate?
Thanks
I think you missed that scriptAll() can take a third "filter function" argument, please refer the docs: https://github.com/intuit/karate/tree/master/karate-core#scriptall-with-filter
* def list_colors = scriptAll('.my-css', "_.style['display']", x => !x.includes('245,00,00'))
Otherwise please refer JSON transforms: https://github.com/intuit/karate#json-transforms
* def filtered = karate.map(list_colors, x => !x.includes('245,00,00'))

Replacing multiple values in pandas column at once

This is an incredibly basic question but after reading through Stack and the documentation for str.replace, I'm not finding the answer. Trying to drop all of the punctuation in a column. What would be the proper syntax for this?
This works but it's absurd:
igog['text']=igog['text'].str.replace(",","").str.replace("/","").str.replace(".","").str.replace("\"","").str.replace("?","").str.replace(";","")
This doesn't:
igog['text'] = igog['text'].str.replace({","," ","/","",".","","\"","","?","",";",""}).
Because I keep getting "replace() missing 1 required positional argument: 'repl'".
Thanks in advance!
You can make a simple loop like this:
t=",/.\?;"
for i in t:
igog[text]=igog[text].replace(i,"")
or you can use regex:
igog['text'].str.replace("[,/.\?;]", "")
or you can use re.sub():
import re
igog['text'] = re.sub('[,/.\?;]', "", igog['text'])
or you can define a translation table :
igog['text'].translate({ord(ch):' ' for ch in ',/.\?;'})

How to use arcpullr::get_spatial_layer() and arcpullr::get_layer_by_poly()

I couldn't figure this out through the package documentation https://cran.r-project.org/web/packages/arcpullr/vignettes/intro_to_arcpullr.html.
My codes return the errors described below.
library(arcpullr)
url <- "https://arcgis.deq.state.or.us/arcgis/rest/services/WQ/WBD/MapServer/1"
huc8_1 <- get_spatial_layer(url)
huc8_2 <- get_layer_by_poly(url,geometry = "esriGeometryPolygon")
huc8_1:
Error in if (layer_info$type == "Group Layer") { :
argument is of length zero
huc8_2:
Error in get_sf_crs(geometry) : "sf" %in% class(sf_obj) is not TRUE
It would be very appreciated if you could provide any help to explain the errors and suggest any solutions. Thanks!
I didn't use the arcpullr package. Using leaflet.esri::addEsriFeatureLayer with a where clause works.
See the relevant codes below, as an example:
leaflet.esri::addEsriFeatureLayer(
url="https://arcgis.deq.state.or.us/arcgis/rest/services/WQ/IR_201820_byParameter/MapServer/2",
options = leaflet.esri::featureLayerOptions(where = IR_where_huc12)
)
You have to pass an sf object as the second argument to any of the get_layer_by_* functions. I alter your example a bit using a point instead of a polygon for spatial querying (since it's easier to create), but get_layer_by_poly would work the same way using an sf polygon instead of a point. Also, the service you use requires a token. I changed the url to USGS HU 6-digit basins instead
library(arcpullr)
url <- "https://hydro.nationalmap.gov/arcgis/rest/services/wbd/MapServer/3"
query_pt <- sf_point(c(-90, 45))
# this would query everything in the feature layer, which may or may not be huge
# huc8_1 <- get_spatial_layer(url)
huc8_2 <- get_layer_by_point(url, query_pt)
huc_map <- plot_layer(huc8_2)
huc_map
huc_map + ggplot2::geom_sf(data = query_pt)

Exclude Value form Dimension

I have this set analysis sentence:
=if(aggr(Rank(Count(WordCounter)),Word)<=70,Word)
I have a request to remove "Among" from the Word data.
Any suggestion?
This is the solution optimal:
=if(aggr(Rank(Count {<Word-={'Among'}>}(WordCounter)),Word)<=70,Word)
Try :
=if(aggr(Rank(Count(WordCounter)),if(Word <> 'Among', Word))<=70,Word)

Matplotlib: how to set dashes in a dictionary?

Can anybody tell me how to use a custom dash sequence in a dictionary. I cannot get that running and the only thing I cannot work with (not a programmer) is the documentation =-(
def lineCycler(): #must be invoked for every plot again to get the same results in every plot
#hasy="#7b9aae"
_styles = [{'color':'#b21a6a', 'ls':'-'},
{'color':'#65a4cb', 'ls':'[5,2,10,5]'},# this shoul be some custom dash sequnece
{'color':'#22b27c', 'ls':'-.'},
{'color':'k', 'ls':'--'}
]
_linecycler=cycle(_styles)
return _linecycler
Use dashes keyword for that (and you need a list, instead of a string):
def lineCycler():
_styles = [{'color':'#b21a6a', 'ls':'-'},
{'color':'#65a4cb', 'dashes':[5,2,10,5]},
{'color':'#22b27c', 'ls':'-.'},
{'color':'k', 'ls':'--'}
]
_linecycler=cycle(_styles)
return _linecycler