Questions tagged [list]
The list tag may refer to: a linked list (an ordered set of nodes, each referencing its successor), or a form of dynamic array. Not to be used for HTML lists, use [html-lists] instead.
141,826
questions
0
votes
1
answer
40
views
How to find duplicates in a text file in python and create a new text file with out them
I am trying to remove duplicates from text files to make a current process more efficient
Example input:
1 1
1 1
2 1
3 1
4 1
Example Output:
1 1
2 1
3 1
4 1
my issue is when ...
0
votes
1
answer
49
views
Transfer dataframe to list and not include NA value
How to transfer dataframe to list and not include NA value ? Thanks!
There is dataframe ori_df
library(tidyverse)
ori_df <- data.frame(category=c('a','b',NA),subcategory=c('w',NA,'Z'))
Below code ...
-4
votes
1
answer
48
views
How to convert a tuple which includes a [string] to a dictionary item
I have this list:
address_table3 = [(1, ['21 South Main']), (2, ['1560 West St']), (3, ['1900 Broadway'])]
I want to convert it to a dictionary with the address as key and integer as value.
When I ...
0
votes
0
answers
22
views
Creation of a json in python with odd structuring going in using python
It is currently not producing the JSON I want there are many issues that I have listed but I am wondering what would make it produce what I want I know that there is probably a simple way to this but ...
-1
votes
0
answers
38
views
cleaning list object containing text and creating new variables using Python
I am trying to create a data frame running the following code -
# pip install edgartools
import pandas as pd
from edgar import *
# Tell the SEC who you are
set_identity("Your Name youremail@...
0
votes
1
answer
15
views
Modify the values in a (global) list of dictionary without reference
I'm new to python - being an educator trying to write to python script to score student's performance downloaded from an online polling platform. I've solved most problems until something like this: I'...
0
votes
1
answer
18
views
How to make a flexible argument list for cursor.execute in python3?
In fact, I want to increase and decrease the mysql query items and the values (arguments) according to the status of the variable values.
based on my scenario I need to make a flexible mysql query ...
-3
votes
0
answers
20
views
how can I compute the striking force of a football player using python [closed]
in a football match between England and Spain Julius Fueke needs a decisive goal, write a Python program that can compute the striking force of each of the players
i tried using the import numpy but ...
-2
votes
3
answers
85
views
How can I rewrite this block of if / Else if into a more structured, condensed and optimal way. (C#)
In C# .NET. This block of if/else if works fine, but its getting cumbersome to maintain and read. I want a more optimized writing style.
if (Globals.SRSI < 10 && Globals.SRSI != 0 &&...
1
vote
4
answers
50
views
How to change the class of elements in a list?
I have a string for input with comma seperated elements. - marks = 'marks1,marks2,marks3'
Using split function I got list of marks. - marks = marks.split(',')
This gives us 'marks' a list with ...
-7
votes
3
answers
72
views
find if everything in a list between two indexes is equal to "empty" in python
I am working on a game in PyGame and I only want an enemy to move if all spaces between them and the player are "empty". the board is basically just a list:
occupants = ["enemy", &...
1
vote
2
answers
39
views
Unpack values from column, which consist of list of dictionaries
I have dataframe, which looks like this:
import pandas as pd
df = pd.DataFrame({"item_id": [1, 2, 3],
"item_properties":[
...
0
votes
1
answer
27
views
need a way to update variable to include all input list items, formatted the same way
I'm running a program in python that sends graphql post requests.
The query looks like this, :
var = input("string here")
query = f"""query{{item1(item2:"{var}"){{...
0
votes
2
answers
44
views
Different behavior when using const before a const constructor in Dart
In the Dart documentation, it states that we should not place const before initializing a const constructor, as the keyword is already implicit.
However, can someone explain why the following codes ...
-3
votes
2
answers
61
views
How to skip first element of each row in csv file without changing csv file
I am using a for loop in python to convert the values from the csv file into integer and float then putting them in a list in the code itself but the problem is with that the csv file doesn't only ...