Linked Questions

0 votes
0 answers
30 views

I have a while looping using a counter to generate separate dataframes based on a variable in a column. As this is in a while loop the dataframe is reassigned to the same name which overwrites what ...
Callum Smyth's user avatar
0 votes
0 answers
20 views

I have many lists ,which are named like a+str(i), such as a0. I want to add the two adjacent ones in turn. a0=['a'] a1=['k'] a2=['e','a'] a3=['k','e'] a0=a0+a1 a1=a1+a2 a2=a2+a3 I want to know ...
rosefun's user avatar
  • 1,887
53 votes
7 answers
202k views

I have a list, with each entry being a company name companies = ['AA', 'AAPL', 'BA', ....., 'YHOO'] I want to create a new dataframe for each entry in the list. Something like (pseudocode) for c ...
Luis Ibáñez Herrera's user avatar
2 votes
5 answers
17k views

Im trying to create a number of lists depending on the number in my header_count. The code below should generate 3 lists but i get a syntax error instead. header_count = 4 for i in range(1, ...
Harpal's user avatar
  • 12.6k
3 votes
5 answers
1k views

(I searched on this website + internet, but couldn't find an answer) I am starting from: myList = ['a', 'b', 'c'] And I want to get something pythonic equivalent of a = [] b = [] c = [] or a, b, c ...
tags's user avatar
  • 4,060
0 votes
3 answers
44k views

I know my title may be somewhat confusing, but I had trouble describing my issue. Basically, I need to create a bunch of variables that all equal 0, and I want to do this with a for loop so I don't ...
Logan Holmes's user avatar
0 votes
1 answer
6k views

I'm working on a Python project and I want to do something like the next example, but is incorrect. I need some help, please! names = ['name1', 'name2'] for name in names: class name: [...
José Manuel Proudinat Silva's user avatar
6 votes
2 answers
15k views

I am a beginner python user. Having trouble getting data from csv into python in the required object format to satisfy a python function. If I manually created the data in python (rather than bringing ...
user8891420's user avatar
2 votes
3 answers
6k views

I want to iterate through a JSON response to match specific key value pair to print it and another value in the same list. The JSON looks like [ { "status": "ok", "slot": null, "name": "...
Bharath's user avatar
  • 588
-1 votes
3 answers
4k views

Suppose I want the variables a_1, a_2, a_3, a_4 to be random numbers from the uniform distribution U(0,100). I could write import random a_1 = random.uniform(0,100) a_2 = random.uniform(0,100) ...
Artus's user avatar
  • 173
0 votes
3 answers
8k views

I want to use some code similar to what follows that actually works: P = 20 n = 1 for x in range(1, P+1): Ax = n #Hoping that you can name the variable from the current element in the range n ...
D Rayner's user avatar
3 votes
2 answers
4k views

I am attempting to name multiple dataframes using a variable in a for loop. Here is what I tried: for name in DF['names'].unique(): df_name = name + '_df' df_name = DF.loc[DF['names'] == str(...
arkadiy's user avatar
  • 766
0 votes
2 answers
3k views

I have a list of names, ['name1', 'name2',... 'nameN'], that I would like to use as names for the resulting dataframes after filtering the original dataframe by each name in a for loop name1 = ...
Jorge's user avatar
  • 2,249
0 votes
2 answers
8k views

I would like to create a dataframe in a loop and after use these dataframe in a loop. I tried eval() function but it didn't work. For example : for i in range(5): df_i = df[(df.age == i)] There ...
Babouch's user avatar
  • 35
1 vote
3 answers
5k views

I want to make variables from a particular column in a CSV. CSV will have the following headers: FolderName,FolderManager,RoleGroup,ManagerEmail Under FolderName will be a list of rows with ...
danielbostock's user avatar

15 30 50 per page
1
3 4
5
6 7
13