53 questions
2
votes
3
answers
39
views
DataTable.ToList() raises collection was modified exception
My application modifies certain DataTable from multiple threads. I have already implemented exclusive locking mechanism for adding rows and committing to DB (2 different threads were handling it). Now,...
0
votes
1
answer
55
views
Iterate in dataframe with more that one element per entry to have lists
I have a dataframe that looks kind of like this. It has two columns and some columns have more than one data. For instance the first row in the first column has "tom-15", "to-13" ...
0
votes
1
answer
29
views
KeyError when converting df to_list
Trying to get one column of a df into a list, but a KeyError is thrown each time.
Writing a function to convert a dataframe to a subplot.
I want to take the first and last value in the df column ...
4
votes
2
answers
266
views
Why does ToList() make a sorted order?
When I execute the following code:
using static System.Console;
var numbers = ParallelEnumerable.Range(0, 50);
WriteLine("\nNumbers divisible by 5 are:");
var divisibleBy5 = numbers
....
0
votes
2
answers
130
views
With Python, move values from a actual column to the end of a previous column under certain conditions
In a dataframe, columns with an NaN in the first row should be added to the last column with a number inside. If there are two columns after another with NaN those should both be added to the last ...
-1
votes
2
answers
85
views
Difference between data fetching through AsQueryable() and through ToList() in ASP.NET MVC 5
I want to know what the exact difference is between the two methods - and when we need either of the two?
I want to improve my querying skills.
0
votes
2
answers
598
views
when i want to print IEnumerable to console screen then i'm getting "System.Collections.Generic.List`1[Linq_1.Objects.UserObject]"
I'm trying to learn Ienumerable with linq.
What I want to do is to print the userlist after filtering it with linq. But I am encountering such a console screen.
Main Code:
class Program
{
static ...
0
votes
2
answers
4k
views
Get value out of a tolist([ data object in Terraform
I have this terraform output:
output "cloud_connection" {
value = data.cloud_connection.current.connection[0]
}
$ terraform output
cloud_connection = tolist([
{
"id" ...
0
votes
1
answer
22
views
What is the difference when converting the Linq result to ToList() and when not converting it toList
In the below example when I donot use .ToList() in the Line - var b = a.SelectMany(x => a.Select(y => { ans.Add(new Tuple<int, int>(x, y)); return false; })).ToList();
The Count of ans is ...
1
vote
2
answers
60
views
In Python, I am comparing dataframes containing strings to decide if it should pass or fail. How can I stop data from passing when it should fail?
I have over 20 test cases that check a CSV for data anomalies due to data entry. This test case (#15) compares the salutation and addressee to marital status.
# Test case 15
# Compares MrtlStat to ...
1
vote
1
answer
402
views
Entity Framework Core error on temporary table when FromSqlRaw invoques COUNT(*)
I'm using the below query in .NET Core 6. If I use anything other than ToList() I get Incorrect syntax near the keyword 'INTO'. Incorrect syntax near ')'.. This only happens when I use COUNT(*). If ...
0
votes
1
answer
777
views
Pandas column tolist() while each row data being list of strings?
I am trying to save & read a data frame that has following formatting
index sentence
0 ['aa', 'bb', 'cc']
1 ['dd', 'ee', 'ff']
When I read the saved csv file and turn the '...
0
votes
1
answer
589
views
Format problem: pandas df.values.tolist() is converting rows into lists but lists each have just one item
Table with 4 Columns and 10 Rows. Reading in as dataframe(df).
Then from there using lists = df.values.tolist() produces
print(lists)
Outcome:
[['30;30;30;0'], ['30;30;30;0'], ['30;30;30;0'], ['30;30;...
0
votes
1
answer
90
views
Export the Subs and Functions in a Visual Basic Solution
I am wondering if anyone knows a way to list out all of the functions and subroutines within a Visual basic Solution?
The short and tall of it is, I have to list out all of the commands in my program ...
1
vote
3
answers
53
views
Convert a txt document to a list to a list starting with [[, instead of ['[
I have a .txt document with this type of text:
[(“Vazhdo”,”verb”),(“të”,”particle”),(“ecësh”,”verb”),(“!”,”excl.”)]
(which represents a sentence and the Parts of Speech tags for each word)
I want to ...
0
votes
1
answer
672
views
serier to tolist() gives elements in squared brackets when appended python
When i convert the series object to list and append each element to a new list the elements are added with extra squared brackets.
Can someone help me on how to remove the brackets or append without ...
1
vote
1
answer
645
views
dataframe combine row values to a list without NaN
I want to combine values in each row to a list and add a column on the dataframe. But some columns have NaN, how can I remove NaN in the list?
df
A B C
2 3 NaN
1 3 1
3 4 6
Expected output
A ...
0
votes
1
answer
213
views
Why this Widget should be returned as List?
(questionList[_questionIndex]['answers'] as List<String>).map((answer) {
return Answer(_textChanger, answer);
}).toList();
this code is part of my main.dart. that code is inside of Column(...
1
vote
1
answer
522
views
Pandas unlist one dataframe column in chain
I would like to unlist one Pandas dataframe column into multiple columns in a chain. Like this, but ideally in a chain to help readability as there are more steps afterwards. Here is my example, which ...
0
votes
0
answers
77
views
Terraform Datasource oci_core_volumes module return string of a function
I am calling Terraform oci_core_volumes module to query block storage volumes, in the response, I am expecting id list of the volumes, but it returned a function tolist instead, how to execute it and ...
2
votes
2
answers
1k
views
Numpy array tolist() problem with floating-point values
I have a Numpy array that I obtained by multiplying a Numpy array with a float.
a = np.array([3, 5, 7, 9]) * 0.1
The resulting numbers are precise without any rounding.
>>> a
array([0.3 0.5 ...
0
votes
0
answers
188
views
Create a 2D List of Random Numbers between Given Range and without Repeating any Number in Python
My code creates an array, shown below:
var1 = array([[0,1,2],[3,4,5],[6,7,8]])
def Ran(var1):
var1 = np.random.choice(9, size=(3,3), replace=0)
#print(var1)
return var1
var1=Ran(var1)
...
1
vote
1
answer
2k
views
convert selected columns of a pandas dataframe to list
I have a dataframe with several columns, among which 'value1' and 'value2':
value1 value2 other
0 13 8 xxxxx
1 14 7 xxxxx
2 17 7 xxxxx
3 18 ...
1
vote
1
answer
85
views
How to split tuples in all columns of a dataframe
The columns in my dataframe contain tuples and empty cells. The number of columns in the dataframe is dynamic and the columns have no lables.
**0 1 2**
**0** ...
1
vote
1
answer
193
views
Read data from Excel and search it in df, TypeError: 'in <string>' requires string as left operand, not float
I read a lot about this Error, but I couldn't find a solution for me.
I have an Excel with 3 columns in which I store keywords. I want to read these keywords and search it in a Pandas Dataframe. The ...
0
votes
1
answer
62
views
How to split a Info column in my Dataframe to 6 separate columns?
The df dataframe consists of one column called Info which has some words separated by ' '. I want to split these and store them in separate columns.
I created the columns and tried the str.split(' ',...
3
votes
4
answers
2k
views
to_list not working with pandas when null values in pandas
df = pd.DataFrame({'a':[None,1, 2], 'b':[None, (1,2), (3,4)]})
a b
0 NaN None
1 1.0 (1, 2)
2 2.0 (3, 4)
I want to set the tuple in the column be to each have their own column. However, ...
0
votes
2
answers
102
views
convert pandas series (with strings) to python list
It's probably a silly thing but I can't seem to correctly convert a pandas series originally got from an excel sheet to a list.
dfCI is created by importing data from an excel sheet and looks like ...
0
votes
1
answer
263
views
got error at parsed.map((e) => list.add(e)).toList(); . how im gonna parsed the json file?
based on code below, the error state on parsed.map is "The method 'map' isn't defined for the type 'String'.
Try correcting the name to the name of an existing method, or defining a method named '...
0
votes
1
answer
443
views
I'm curious about the speed difference between Kotlin's toList and IntArray
I was curious to see what Kotlin's toList is returned in, so I tested it.
fun loop(i: Int){
for(i in 0..i){}
}
fun main() {
val list: List<Int> = (1..100000).toList()
val arr = ...
0
votes
1
answer
65
views
Manipulating/splicing List of Lists
Good evening,
May I please get advice for the following code? Here is what I have:
z_list = df.iloc[0:5000,2]
n = 1000 #chunk row size
list_df = [z_list[i:i+n].tolist() for i in range(0,z_list....
-2
votes
2
answers
648
views
Can't give back manager.list in Python multiprocessing from subprocess comes from array.tolist()
I would like to change a manager.list in a multiprocessing subprocess with via array(a).tolist(). Appending the list in subprocess works but changing with that method doesn't.
Any hint what is wrong? ...
0
votes
0
answers
57
views
Customized read, split, and add to a list of objects from a large file
I am trying to figure out how I can customize read data from large file, the file is organized in this way :
some text : Lorem Ipsum is simply dummy text of the printing and
typesetting ...
1
vote
1
answer
135
views
Iterating over a list parsed over from a cvs. column
I am trying to iterate over a list that contains temperatures.
Appending the data/temperatures from a csv file to a list data structure was a not an issue. The problem occures when i want to count ...
0
votes
1
answer
1k
views
How to convert dataframe to list without adding more decimal places in python
I have a dataframe. The values are 5 decimal places as shown in the first image.
After I use df.values.tolist() to convert to list, some became more than 5 decimal places as shown the 2nd image.
...
3
votes
5
answers
2k
views
Add all values of an instance of an object to a List
Say i have a class 'Dog' with a lot of String values and i want all of those values in a List, would there be any better way than adding every value by themselves?
e.g. take this dummy class, note ...
0
votes
3
answers
317
views
Filling a fixed number (x) of new columns with tolist() function which sometimes contains less items (< x)
I am using tolist() to split up a 8-item-list in 1 column ('modelGreeks') into 8 new columns in that same dataframe:
pd.DataFrame(df['modelGreeks'].tolist(), index=df.index)
df[['IV_model', 59, '...
0
votes
1
answer
205
views
Need to add array elements to list. Trying to use "tolist", "extend", and "append", but not successful
I'm trying to create a list that has image_id then several prediction percentages. The prediction percentages (yhat) are in a np array. I thought that using "tolist" then "extend" then "append" ...
-1
votes
1
answer
21
views
Incompatibele types error when copying code
I'm setting up a logger in a program but used some code from another program. I could fix all errors except for an incompatible type error returned by a Collectors.toList().
The error:
https://i....
6
votes
2
answers
4k
views
java IntStream cannot use collect(Collectors.toList()), compilation error, why? [duplicate]
As below:
IntStream iStream = IntStream.range(1,4);
iStream.forEach(System.out::print);
List list1 = iStream.collect(Collectors.toList());//error!
Java 1.8 compiler gives type deduction ...
1
vote
1
answer
227
views
export looped numpy histogram outputs to list without array information and formatting
I am running through a loop of data compiled from a number of lists. I am eventually going to create a histogram, however I want the binned outputs from the histogram function to be exported to a list....
1
vote
3
answers
273
views
Python Pandas | Create separate lists for each of the columns
I am not sure how to use tolist to achieve the following. I have a dataframe like this:
Param_1 Param_2 Param_3
-0.171321 0.0118587 -0.148752
1.93377 0.011752 1.9707
4.10144 0....
3
votes
2
answers
3k
views
Why I use "Collectors.toList()" rather than "Collectors::toList" in Java 8 Lambda? [duplicate]
Usually after a flatMap, we use collect(Collectors.toList()) to collect data and return a List.
But why can't I use Collectors::toList instead? I tried to use it, but got a compilation error.
I ...
2
votes
1
answer
466
views
df.columns.tolist() to return strings not tuples
in pandas to find the columns of a df you do:
df.columns
which returns a multiindex array.
If you want to add it to a variable you do:
columns=df.columns.tolist()
which would create a tuple for ...
1
vote
1
answer
659
views
How to convert a numpy.ndarray type into a list?
I want to read a matfile in python and then export the data in a database. in order to do this I need to have the data type as list in python. I wrote the code below:
import scipy.io as si
import csv
...
-3
votes
1
answer
185
views
Java .stream() not saving List<> sorting in .toList() - prints blank
-- I'm using .stream() to filter a List by name initial chosen by the user and print it out, but I can't get the sorted list to print correctly; it only prints white space. I think it's not saving the ...
-4
votes
1
answer
316
views
C++ problematic function, Array to List [closed]
I have this code from programing class:
void ToList(List *first, int *arr, int n) {
List *p = first;
for(int i=0; i<n; i++) {
p->x = arr[i];
if (p->next != NULL) p = p-...
0
votes
1
answer
3k
views
Rx Java parsing a List to RealmList
So, here is my code:
@Override
public RealmList<RealmStuff> call(List<Stuff> stuff) {
return Observable.from(stuff)
.map(this::getRealmStuff)
.toList()
...
0
votes
1
answer
712
views
numpy tolist() uncomfortable output
I'm trying to extract a column of a numpy matrix in a list form. I've used the method tolist(), but it is not useful for my purpose.
Let see the code.
import numpy as np
def get_values(feature):
'...
0
votes
0
answers
41
views
Python list has drift in values [duplicate]
I was having troubles with iterating through a list in Python. For this I fiddled a little bit with making a numpy array iterable and came to the following (still not functional) stage:
import imp
...