All Questions
254
questions
3
votes
1
answer
47
views
Using Exists with a Predicate<T> on a list with null items
I'm trying to find the index of an item in a list with something like
listx.FindIndex(SomePredicate<T>)
but I get an error
NullReferenceException: Object reference not set to an instance of ...
-6
votes
3
answers
108
views
Searching a list by an undefined value [duplicate]
There is a certain list that I get after parsing a certain html page:
Could you tell me please, how can I do a search for a specific value?
Let's say I specify only part of the value KES_ and the ...
0
votes
3
answers
288
views
Python - Print on screen the letter in position "x"
I need to find and print a letter of a word.
For example: wOrd
I want to print only the uppercase letter. I tried using "find()" it shows me the position of the letter but I can't show the ...
0
votes
3
answers
120
views
Filter parameter by length for pattern recognition in python
I'm working with large files, in this case a file that has one word per line and over 300k lines. I'm trying to find a way to obtain the most common patterns present in the words of the file. For ...
0
votes
2
answers
79
views
How to find element in one of two lists
I can search a list, I was using this:
if (!mylist.Any(item => item.Thing == searchitem))
{
var myvar = mylist.Find(item => item.Thing == searchitem);
}
However, there's a ...
0
votes
3
answers
56
views
how to find a similarity in a list in python
I want to find an instance in a list that is present in another list. However I am unable to make it so that that happens. To put it in a more practical perspective:
I have this list:
listA = [['0', '...
0
votes
1
answer
65
views
find 1's in the row
I have a task to do:
a = [0,1,0,1,0,0,1,1,1,1,0]
I have the list - a - randomly generated each time the program runs.
Task 1: find the longest 1-row (here it is [1,1,1,1]) and output its starting ...
-1
votes
1
answer
242
views
IndexError: list index out of range
i have a code that compares a list to a list comprised of lists too find out if a similar list exists there. If a similar list exists, the code has to identify the string in that similar list but it ...
0
votes
0
answers
14
views
Find the data related to a list of elements from a collection in MongoDB using python
I have a list of SensorIDs (lstSensorList).
I'm going to fetch the data related to all these sensorIDs from a collection (TimeSeries) in MongoDB.
I can fetch the data related to a particular element ...
0
votes
3
answers
64
views
How can I replace the strings of the list with the category with Python?
I have a list of strings like:
df = [['cutting_board', 'knife', 'cucumber', 'plate'],
['bread', 'plate', 'knife', 'cutting_board'],
['cutting_board', 'knife', 'orange', 'plate'],
[ 'plate', '...
0
votes
2
answers
37
views
How to find substring in list and return to substring in list instead of true or false only
Hi i have dataset something like this
dx = pd.DataFrame({'IDs':[1234,5346,1234,8793,8793],
'Names':['APPLE ABCD ONE','APPLE ABCD','NO STRAWBERRY YES','ORANGE AVAILABLE','TEA ...
1
vote
1
answer
69
views
How to define groups of mutables?
Lists are a mutable data type. If I have sublists inside a 2d list that have multiple references to the same object, the fact that changing any one makes changes in others suggests a question: am I ...
0
votes
2
answers
82
views
Find and replace a string using another list of string in python
I have a text
original = '3200 NORTHLINE AVE STE 360 GREENSBORO 27408-7611 US NC'
I need to find US and put it at the end: like this
lookup= 'US'
result = original.replace(lookup,"") + &...
0
votes
2
answers
1k
views
Is there a way to find specific character in string list python?
I have a list which contains string values taht represents calculations. From them I want to get a specific character, let's say plus and minus signs.
I tried using var1.find('a') != -1 or var.find('z'...
0
votes
1
answer
23
views
how should I find names with a shared characters in a list names in python?
I have a list of names, let's say like ['R_1', 'ER_1',ER_2''R_2','R_3', 'ER_1',ER_2', 'C1', 'R_5',...]. Then I want to find those which has 'R' in common, or 'ER'. Which command should I use?
I would ...