All Questions
590
questions
-4
votes
1
answer
63
views
Python Apply function to create new rows in loop
Goal: Here is a sample of a dataset that has "ID", "PHASENAME", "CDAYS", "MULTI_FACTOR", "DAY_COUNTER", and "DAILY_LABOR_PERCENT". The goal ...
0
votes
2
answers
37
views
how do i create and append to a new dataframe utilizing a iteration loop to extract of data?
i want to have a basic direct method to use different criteria to form new dataframes which i will display in a simple pie chart. i have such a feeble grasp of the topic that it seems to be difficult ...
1
vote
2
answers
43
views
Check if greatest rolling change is less than a specific number in dataframe
I have a dataframe of a time series of stock prices and need to see at any point in time if the change (whether it be pct_change(1), pct_change(2), ... , pct_change(7) is less than 20%).
The logic I ...
0
votes
0
answers
68
views
Iteratively output (print to screen) pyspark dataframes via .toPandas()
I'm working in an .iypnb with pyspark and pandas.
I'd like to be able to take my dataset (df) and loop through various columns, outputting a freq table of the values within that column.
Doing so with ....
0
votes
1
answer
105
views
How to efficiently standardize data in relation to preceding entries
I am trying to write a python script to standardize a big set of data (>10000 entries) in range of -1 to 1 in relation to preceding entries.
What I'm currently doing is iterating through the set ...
0
votes
1
answer
54
views
Create a Loop that Randomly Populates a collection of Binary DataFrames matrices- Python [duplicate]
I need to create a collection of DataFrames, randomly populated with 0's and 1's. I want to do this iteratively.
I create one such DataFrame by the following code:
bin1=np.random.rand(4,4)
...
0
votes
0
answers
61
views
Creating a loop for a dataframe update the appends a series based on 2 variaables
Dataframe Shifts_to_Update has been developed to provide a list of call times and quantity of each call time that will be used to update the All_Shifts dataframe. These shifts will change from "...
0
votes
3
answers
117
views
Multiply row based on column information and change column value while iterating through dataframe in pandas / python
I am having the following dataframe (example of one row):
quarter
value
distribution
type
...40 other columns that stay untouched
2024Q2
0.5
{'2024Q1': 91, '2024Q2': 91}
MCF
XYZ
I want to multiply ...
0
votes
2
answers
187
views
Function for converting columns of a data frame into key value pairs
I have a dataframe (these are just sample columns for reference, the actual number of columns is quite large)
id
A
B
C
D
123
24
98
74
32
456
65
90
61
96
I would like to convert it into a data ...
2
votes
1
answer
40
views
To compare date columns in grouped data
In the below dataframe,
patient admit discharge 30d_admit
0 a 2022-03-01 2022-03-01 2022-01-31
1 a 2022-02-02 2022-02-02 2022-01-04
2 ...
0
votes
2
answers
586
views
Iterate through chunks of a pandas Dataframe
I have a pandas.DataFrame that looks like the following:
Week
Monday
Tuesday
Wednesday
Thursday
Friday
City A
100
300
x
z
w
City B
200
400
y
q
p
None
None
None
None
None
None
Week
Monday
Tuesday
...
1
vote
1
answer
32
views
Pandas. How to improve performance. Iterating is too slow
I have a dataset like
id
open_month
end_month
quantity
001
2023-01-31
2023-02-28
1
002
2023-01-31
2023-03-31
5
003
2023-01-31
2023-04-30
4
004
2023-02-28
2023-02-28
2
005
2023-02-28
2023-03-31
3
...
0
votes
1
answer
37
views
How to stop appending to a list and start another list when doing iteration using for function?
I am trying to add more users that will answer some questions. But the new file to save their answers, shows answers in one row. So, the users and their answers do not match their respective headers. ...
0
votes
1
answer
41
views
Doing a vlookup type chain in a python dataframe, which labels the number of iterations complete and publishes results in another dataframe
I'm looking to attempt a vlookup chain in a dataframe and the results be published in a new dataframe.
The actual dataframe as many columns but for this task i'm only interested in 2. The data or ...
0
votes
1
answer
63
views
How to iterate through unstructured txt file with list of invoices and its items and to create a pandas dataframe
guys
I have a txt file with a list of hundreds of invoices and its items, which varies from 1 to 10, depending on the invoice. The TXT file looks roughly like this one:
-------REPORT--------
Invoice..:...