Questions tagged [filter]

1

votes
1

answer
338

Views

Conditions on django filter backend in django rest framework?

I am using Django filter backend on few fields which is working very good. But i want to filter fields when i get specific condition Like if user_type is basic get filter query otherwise get all objects from model. Mine code for filters is here: http_method_names = ['get'] serializer_class = SearchS...
Salman Ahmed
0

votes
0

answer
15

Views

How do I dynamically change a dataframe in my site by user input? (for example maybe rearrange the same column by value? from max to min?)

I want to have an option in the table in my site that allows the user to rearrange the table by min or max value in a specific column, but couldn't find anything about this. The dataset I am using is this: https://raw.githubusercontent.com/plotly/datasets/master/bubble_chart_tutorial.csv I want the...
Dat Guy
1

votes
3

answer
882

Views

Django-filters: multiple IDs in a single query string

Using django-filters, I see various solutions for how to submit multiple arguments of the same type in a single query string, for example for multiple IDs. They all suggest using a separate field that contains a comma-separated list of values, e.g.: http://example.com/api/cities?ids=1,2,3 Is there a...
mart1n
1

votes
1

answer
189

Views

filterset lookups for annotated fields

i have a problem to create a filterset for one of my ModelViewSets to provide filter functionality (incl. all allowed lookups e.g. in, gt, lt, ...) for annotated fields in my api. My Code looks as following: import rest_framework_filters as filters from django_filters.rest_framework import DjangoFil...
Smie85
1

votes
3

answer
720

Views

Filtering on action decorator - Django Rest Framework

I am trying to filter data using a decorator action on Django Rest Framework, it works perfect if I use the global queryset (get_queryset() function) but I need to use it in a separate function. I am using django-filter to perform it. This is the code. My view: class ShippingAPI(viewsets.ModelViewSe...
Jeremias Enriquez
1

votes
3

answer
72

Views

JQ Select Objects Where Inner Key Exists

I am trying to select credential objects only if key credhub-ref exist within them from the following JSON: { 'total_results': 23, 'total_pages': 1, 'prev_url': null, 'next_url': null, 'resources': [ { 'entity': { 'credentials': {}, 'binding_options': {}, 'gateway_data': null, 'gateway_name': '', 's...
Radford
1

votes
1

answer
100

Views

How to filter by BlankNode id

I'm trying to run this query in the SPARQL playground on GraphDB. select * where { ?s content:value ?value . FILTER REGEX(str(?value), '_:x1697BD364N0abcdd866d54') } ?value are BNodes I'm trying to filter all values where the BNode ID is: _:x1697BD364N0abcdd866d54 I've tried a few different ways t...
ueeiieu
1

votes
1

answer
27

Views

C - error: incomplete definition of type 'struct name_s'

I try to implement a bloom filter in C. I split the file in two header one public and one private. The first contain the function's signature e the typedef of the struct and the second the definition of the struct. This is the code of the below heade: bloom_filter_private.h #ifndef BLOOM_FILTER_PRI...
th3g3ntl3man
0

votes
4

answer
28

Views

Selecting Items in array - Javascript - Using Filter method

Someone asked a question today about figuring out to select certain elements within an array from I to the end of the array and it made me wonder how to do that with the filter method. One of the solutions that someone gave was to use slice and I understand that you're able to select from index to...
mph85
0

votes
0

answer
4

Views

Ionic 3 cannot convert filter() result into array

I have the initial array of data dataToDisplay and the array that I need to add filtered arrays into it dataToDisplay. I used .filter() to do so: this.dataToDisplay = this.dataToDisplay.filter((res)=>{ console.log(res); if(res.type==this.filterArray['typeOfIns']) { this.dataToFilter = res; console.l...
alim1990
0

votes
3

answer
24

Views

How do you find if a value is found in specific columns?

ID Pred1 Pred2 Pred3 Obs1 Obs2 Obs3 FP 1 Boston Tokyo London Boston London Other 0 2 Tokyo London Paris Seattle Paris Other 0 3 London Berlin Paris Paris Berlin London 0 4 Seattle Berlin London Tokyo Paris Boston 1 This is my dataset. What I am tryi...
Molly
1

votes
4

answer
2.4k

Views

How to let SearchView keep its last query content after reopen?

When using search view, I have a requirement from customer that they want to retain the search content after reopen the search view. My Search view is on a list view and do a real timing filtering based on what user input into the search box. When closed the search box by either click the back butto...
Arthur Wang
1

votes
1

answer
18

Views

Django: Can I check if a model instance matches a filter without filtering all model instances

I have an instance of a model. I have a queryset. Can I check if the instance matches a filter without filtering all model objects? Situation: I have a model Alpha, when this model is created I need to check if it matches a user defined filter which is stored in model Bravo. There will be many Alpha...
user3238415
-3

votes
0

answer
12

Views

Is there any HyperLogLog lib in C# available? [on hold]

Is there any open source implementation of HyperLogLog lib in C# available?
Yinfang Zhuang
0

votes
0

answer
25

Views

Changing camera Back to front while capturing the video cause a weird issue

I am creating camera app which capture video using SCRecorder. I am trying to apply multiple filters to a video. I am changing Recorder's video configuration as below func swipeableFilterView(_ swipeableFilterView: SCSwipeableFilterView, didScrollTo filter: SCFilter?) { selectedFilter = filter! reco...
Khush
0

votes
0

answer
4

Views

How to generate schema for multiple choice filter?

In our API we have an endpoint to list locations. We allow filtering on location type, and we allow multiple values for this filter. For example: GET /location/?type=hotel&type=airport For filtering we are using django-filter. However, drf-yasg doesn't seem to correctly generate the schema for this...
DMFerrer
1

votes
1

answer
678

Views

How to search from many fields?

I have custom filter to my viewset: class OrderFilter(django_filters.rest_framework.FilterSet): username = django_filters.CharFilter(name='user__username', lookup_expr='icontains') client_name = django_filters.CharFilter(name='user__first_name', lookup_expr='icontains') class Meta: model = Order exc...
Nips
1

votes
2

answer
980

Views

Using greater than with Lo Dash

How do I filter an array using greater and less than with Lo Dash? Using Lo Dash's _.find demo data: var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user': 'fred', 'age': 40, 'active': false }, { 'user': 'pebbles', 'age': 1, 'active': true } ]; I would like to find all users...
Bethany
0

votes
0

answer
7

Views

How to fix 'TypeError: Cannot read property 'items' of undefined'

I am trying to display a reference field from my database as a result on my filtered repeater. I am unsure of how to code the page correctly for this to happen. When testing my code, this is what shows in the developer console: Loading the code for the SEARCH WITH VIN page. To debug this code, open...
Brittani
1

votes
1

answer
88

Views

Using feMorphology svg filter trims corners in the output

I am using SVG filter feMorphology's dilate to implement shadow spread for a shape. Am expecting below result. Test But my code returns somewhat trimmed corners in some shapes. Help me sort out this.
Muthurathinam
1

votes
2

answer
834

Views

How can I use Date Picker with django-filter?

I am trying to figure out how can I use datepicker with django-filter. I have tried a bunch of widgets but it's not working. Any suggestions will be appreciated! I want to use datepicker for the row_date search filter. filters.py from home2.models import AvailstaticCopy from django import forms impo...
Jass Waraich
1

votes
2

answer
407

Views

Filter dataframe by vector of column names and constant column names

This is surely easy but for the life of me I can't find the right syntax. I want to keep all 'ID_' columns, regardless of the number of columns and the numbers attached, and keep other columns by constant name. Something like the below command that doesn't work (on the recreated data, every time):...
Neal Barsch
1

votes
3

answer
399

Views

Remove duplicates in one column based on another column

I'm looking for a nicer way to do this in R. I do have one possibility but it seems like there should be a smart/more readable way. I want to delete duplicates in one/more column only if a condition is met in another column (or columns). In my simplified example I want to delete duplicates in colu...
user2738526
1

votes
2

answer
965

Views

How to add a custom header in Spring WebFilter?

I'm trying to add a custom filter before I invoke my REST Service. In this below class, I'm trying to add the custom filter in the HttpRequest but I'm getting error :- java.lang.UnsupportedOperationException: null at java.util.Collections$UnmodifiableMap.computeIfAbsent(Collections.java:1535) ~[na:1...
Vinod Kumar
1

votes
1

answer
40

Views

Select unique values in dataframe based on sorted value

Has anyone selected unique values from a dataframe based on a second value's highest value? Example: name value cheese 15 pepperoni 12 cheese 9 tomato 4 cheese 3 tomato 2 The best I've come up with - which I am SURE there's a better way - is to sort df by value descending, extract df$name, run uniqu...
Christopher Penn
1

votes
3

answer
52

Views

Deleting a particular element from an array

state = { filters: ['all'] } this.state.filters.includes('humans') ? this.state.filters.filter(val => val !== 'humans') : this.state.filters.push(dropdown) I'm using a condition such that, when I click on a button the item('humans') gets pushed to state and when I click on the same button again I n...
PremKumar
1

votes
2

answer
44

Views

Filter Custom Array time optimization

I have to filter array of articles based on a keyword(string) in article's description. Filtering is taking 2-3 seconds on 1500+ elements's array of type Article and 2000+ words in each article description. I am using below code; i also tried predicate but didn't worked for me. let searchResult = ar...
1

votes
2

answer
36

Views

Using Filter and Map to Modify Merged Array

I have the following code, which takes 2 arrays of objects in JavaScript and compares them and merges the contents, returning all objects from the 1st array, plus all objects from the 2nd that have an id that's not in the 1st. But for those items that come from the 2nd array, I want to modify its en...
J Woodchuck
1

votes
1

answer
44

Views

Filtering away javascript objects into an array when using fetch

I have a react application, where I use the axios library, to get some values, and set them into an array of javascript objects in my state componentDidMount(){ axios.get('http://localhost:8080/zoo/api/animals') .then(res => this.setState({animals: res.data})) } Now I want to check if the objects, c...
baileyhaldwin
1

votes
4

answer
68

Views

filtering tuple inside a tuple recursively

i'm trying to figure out how to filter a tuple inside a tuple like so: input>>>filter_tree((1,2,3,4,(1,2,3)),lambda x:x%2==0) output>>> ((2,4,(2)) this is how far I got : def filter_tree(tree,f): if type(tree)!=tuple: return tree return tuple(filter(f,tuple(filter_tree(node,f) for node in tree)))...
Alex K
1

votes
4

answer
45

Views

Filter by lowest and highest years by group using dplyr

I feel like the answer here is obvious, but I can't nail it down. I have this dataframe: df % group_by(SIC) %>% filter(!is.na(value)) %>% filter(year %in% c(min(year), max(year))) # A tibble: 35 x 3 # Groups: SIC [18] SIC year value 1 12 2011 0.081 2 11 2011 0.218 3 7 2011 0.212 4...
elliot
1

votes
1

answer
52

Views

How to break javascript operation on input and start new operation

I have produced a table but I am using s instead of s and s. here is an example: Title Link Size(MB) UploadDate Show I will fill tbody part with server-side operations. I use below codes to filter my rows based on values entered in filter inputs. $('.Filter').on('input', function () { filterGrid(...
Behnam
1

votes
1

answer
80

Views

How to define range of natural numbers as chars in Haskell?

I tried: ['1','2',..] but this takes into account other characters also. I could do [1,2..] , But for my application I need to check the following: filter (\x -> x `notElem` ['0','1'..]) 'a 1 255 d e 6 g h' Which attempts to filter out all elements including spaces that are not natural numbers, in...
Mandy
1

votes
4

answer
43

Views

How to Add new key and value to array in javascript?

I have two array, lets suppose have below value of array: ' var array1 = [ {Id: '809cd136-02c7-4cc8-b9de-04fd3359b265', Name: 'testing'}, {Id: '609d3a78-8f7c-4843-acdb-2dcfc73c0d96', Name: 'Delhi'}, {Id: '264d54cb-b104-48ed-91db-673327ae8d0e', Name: 'rohit-auditor'}, {Id: 'ce9691b3-dc55-4d30-baf4-79...
rohit13807
1

votes
3

answer
23

Views

Filtering dataframes in named list based on the name of each dataframe

I have multiple data frames in a named list, reproducible example below: set.seed(1) df1
Beeba
0

votes
0

answer
8

Views

Selecting rows based on multiple conditions including date trasnformation

I'm working on some research focusing on the effect of credit rating downgrades on bond prices. I have a dataset of different bonds with data for each day, so each row consists to a specific bond on a specific day. Below is a small extract of said table: bonds # A tibble: 6 x 4 ISIN Dat...
rbonac
1

votes
1

answer
80

Views

Remain constant Woocommerce prices regardless of tax rate - B2C

Note - im new, so please be kind. If anything isnt clear please tell me, so i can improve my questioning! As a person who lives in europe and sells products to end-consumers, the following problem is very ipmortant and in my opinion heavily under-prioritised. There are a lot of conversation regardin...
evavienna
1

votes
1

answer
97

Views

MDX - filter empty outside of selected range

Cube is populated with data divided into time dimension ( period ) which represents a month. Following query: select non empty {[Measures].[a], [Measures].[b], [Measures].[c]} on columns, {[Period].[Period].ALLMEMEMBERS} on rows from MyCube returns: +--------+----+---+--------+ | Period | a | b...
Fd-ski
1

votes
1

answer
520

Views

Applying Butterworth High Pass Filter

I have a problem with applying Butterworth High Pass Filter to my data. I would like to print filter for Bx and By matrix. As you can see I have both positive and negative values, how to apply math.fabs() to Bx and By to get only positive values? For my high pass filter I have those requirements: F...
Hiddenguy
1

votes
1

answer
189

Views

Loading a JSON file inside AngularJS custom filter

I'm new to Angular JS. I created a custom filter function and I have separate JSON files (which contain language translation data). I'm storing the user's option in the local storage, and I want to load a specific JSON file's content into my custom filter based on that local storage value. Ex: If th...
apple_92

View additional questions