All Questions
2,817
questions
0
votes
1
answer
34
views
Create a new column based on other columns for time series data in pandas
I have the following pandas dataframe with columns May, June, and July.
Month
June
July
Aug
June
a
d
g
July
b
e
h
Aug
c
f
i
I want to create a several new columns with a 1 month forecast, 2 month ...
0
votes
2
answers
84
views
How to calculate the Relative Strength Index (RSI) through record iterations in pandas dataframe
I have created a pandas dataframe as follows:
import pandas as pd
import numpy as np
ds = { 'trend' : [1,1,1,1,2,2,3,3,3,3,3,3,4,4,4,4,4], 'price' : [23,43,56,21,43,55,54,32,9,12,11,12,23,3,2,1,1]...
-3
votes
0
answers
33
views
Counting OTPs by Sender, Missing first four OTPs from Senders(first) even if the sender has more than 5 Counts
import re, csv
import pandas as pd
class OTPAnalysis:
def __init__(self) -> None:
self.total_otp = []
self.count = 0
self.df = None
self.sender_count = {}
...
-4
votes
1
answer
64
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 ...
-1
votes
1
answer
71
views
When looping though a dataframe looking for string values. How do I print out rows without duplicating if the search term is found multiple times? [duplicate]
I am importing pandas and reading a csv file.
import pandas as pd
df = pd.read_csv(r'C:\Users\Me\MyFile.csv')
I am converting the dataframe to strings and making the contents lowercase
df_low = df....
0
votes
1
answer
50
views
How to avoid loop in Pandas iterating unique values?
I have a table with users and times of their actions:
user_ id
time
user_action
user_1
1
action_1
user_2
2
action_2
user_1
3
action_3
user_2
4
action_4
My algorithm includes looping over unique ...
-1
votes
2
answers
34
views
how to create sub dataframes, appending rows if some column value is included in a list? [duplicate]
I have a dataframe like this
Data = pd.read_csv('info_com.csv')
df1 = pd.DataFrame(Data)
This DF has a column 'Code', that includes all product codes, and the DF pretty much includes all the ...
0
votes
1
answer
28
views
Filling the table using data from Pandas dataframe
I have to fill the table below using reports from each week. Instead of doing it manually I was trying to automate this process by writing few lines of code.
I've managed to aggregate the date from ...
1
vote
3
answers
56
views
Concatenating row, column indexes from a dataframe
I have one dataframe like this with the first column is the index (i.e., index = [1,2,3]):
1 2 3
1 0 0.43 0.61
2 0.88 0 0.12
3 0.33 0.95 0
The new dataframe ...
0
votes
1
answer
39
views
Comparing One Record in Pandas Dataframe To All Other Records in Dataframe
I have a situation where I want to compare every value in one column of a dataframe against every other value in the same column. In this case, for every product, I want to see for Hyundais the ...
2
votes
2
answers
53
views
How to Loop through each element of a loop and filter out conditions in a python dataframe
I have a list of subcategories and a dataframe. I want to filter out the dataframe on the basis of each subcategory of the list.
lst = [7774, 29409, 36611, 77553]
import pandas as pd
data = {'...
0
votes
1
answer
109
views
yahoo finance indicators and growth rate calcualtions
I am trying to create growth rates for thirty days after download the data from yahoo finance. I used the following codes and a function but my output prints the same numbers for all days ( 1-30) days ...
0
votes
3
answers
58
views
Python: Pandas, alternatives options for iterrow
I would know a more efficient way to iterate over rows on a pandas dataframe compared to iterrows.
I know that it exists the option of map but I can't find a good example.
Many examples are based on ...
0
votes
0
answers
32
views
Is there any option to return column/row value in pandas instead of printing [duplicate]
Hi, Above is my data frame I want to execute .csh launch for given machine, is there any way to iterate and execute .csh instead of printing value using iterrows.
for idx, row in df.iterrows():
...
0
votes
0
answers
63
views
dynamically mapping an excel spreadsheet using python and pandas [duplicate]
I have a large excel spreadsheet that I need to read data from certain rows, columns and cells and then output into a different dataframe format. How would I capture the data in specific cells while ...