All Questions
157 questions
1
vote
1
answer
74
views
Splitting Mismatched Rows into Multiple Rows in a Pandas DataFrame
I would like to split the mismatched values within each column into separate rows while preserving the values in the 'Gene.ID' column for the new rows.
import pandas as pd
data = {
'Gene.ID': ['...
0
votes
1
answer
387
views
How to Calculate and Append Forecasted Values Based on Average Growth using Python?
I'm very new to Python, but am trying to do some basic automating of some company processes.
One of the processes is a basic forecast, where the numerical average growth is added to the last month's ...
0
votes
2
answers
102
views
How can performance be improved when iterating over NumPy array?
I'm analyzing large amounts point cloud data created by a laser scanner. In the third step I remove points based on their z-value but my function is really slow.
Import
The data is imported from a ....
0
votes
1
answer
193
views
how to add multiprocessing to loops?
I have a large customer data set (10 million+) , that I am running my loop calculation. I am trying to add multiprocessing, but it seems to take longer when I use multiprocessing, by splitting data1 ...
1
vote
3
answers
1k
views
Python: How to filter a Pandas Dataframe by matching any value in a list to Column that contains lists
I have a Pandas Dataframe with a column titled 'Ingredients' which contains lists of ingredients that are relevant to a row.
I have a multi checkbox which creates a list of checked items called '...
6
votes
3
answers
263
views
How to speed up the loop in a dataframe
I would like to speed up my loop because I have to do it on 900 000 data.
To simplify i show you a sample.
I would like to add an column name 'Count' which count the number of times where score was ...
0
votes
1
answer
118
views
Python script to sum values according to conditions in a loop
I need to sum the value contained in a column (column 9) if a condition is satisfied: the condition is that it needs to be a pair of individuals (column 1 and column 3), whether they are repeated or ...
0
votes
3
answers
142
views
Conditional Fillna in Pandas with conditional increment from the previous value
I want to fillna values in the 'last unique id' column based on the increment values from the previous row
**input is**
Channel last unique id
0 MYNTRA MN000351370
1 NYKAA NYK00038219
2 ...
-2
votes
1
answer
120
views
TypeError : unsupported operand type(s) for +: 'NoneType' and 'int'
import pandas as pd
import numpy as np
import openpyxl
time = pd.ExcelFile('Block_time_JP1.xlsx')
time.head(3)
output :
Date_time Station Pending
0 28-11_15:30 DTK2 36
1 28-11_15:30 ...
0
votes
0
answers
49
views
repeating in df with function python
I have this df where in the Order column if greater than 0 results in long, if less than 0 results in short. I would like to create a column that calculates the result of profit or loss when the ...
0
votes
1
answer
16
views
How do I combine variables by name and then find the average of another variable based on that?
Data Set Example
Attached in the picture is an example of my data set. For example the first value under Hunt name is Beaver. There are multiple instances of Beaver under Hunt name for different years....
0
votes
1
answer
116
views
How to Vectorize for loop/pandad iterrows with condition outside of loop python
I am trying to make a set of code I have faster using vectorization in Pandas (or NumPy). I basically need to have a "trailing" condition as I loop through each row of a dataframe so that I ...
0
votes
2
answers
91
views
How to rewrite a for loop to get a solution faster in pandas?
DataFrame df:
no column has a single int value 1-28 in increasing order, until the next group starts (dataframe is presorted). Some values are missing (e.g 1,2,3,5,7,1,2,3,28,1 ...)
intensity column ...
-1
votes
1
answer
343
views
How to add another iterator to nested loop in python without additional loop?
I am trying to add a date to my nested loop without creating another loop.
End is my list of dates and end(len) is equal to len(year).
Alternatively I can add the date to the dataframe (data1) is that ...
1
vote
2
answers
67
views
How can I increment a list within a loop without a second loop?
I am trying to loop through an array of month end dates t within my current loop without creating another for loop.
t=np.array([[30],[31],[31],[31],[28],[31],[31]])
n = 7
for i in range(0, n):
...