All Questions
86 questions
0
votes
1
answer
207
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
0
answers
22
views
Efficient way to use apply a function on Pandas rows [duplicate]
I am looking for an efficient way to apply a function on each row of a dataframe to perform some operation and repeat the row by a number defined in other column. Currently, I am doing it by iterate ...
0
votes
1
answer
80
views
looping functions over series of csv's
I have code here to find average size and stdev of specific peaks in an intensity plot. I have it working for an individual file but I want to be able to run multiple files at once and combine the ...
0
votes
1
answer
100
views
Function does not return expected dataframe output
I'm a newbie in programming, python, nlp and stackoverflow so grateful for your patience!
I have developed a function that extracts some text from several pdf files and sets up a pandas dataframe with ...
1
vote
1
answer
3k
views
How to resolve 'KeyError' issue in Pandas dataframe when using a custom function in a loop?
Unable to find out the problem of a defined function that is used in a loop.
The program I am trying to develop, is about a supply chain management that involves planing and managing deliveries and ...
1
vote
2
answers
787
views
Computing Jaccard Similarity between DataFrame Columns
Here's what my dataset looks like:
I want to iterate over columns to compute Jaccard similarity. I am not interested in using libraries to do it btw.
Here's my code:
def jaccard_binary(x,y):
&...
2
votes
2
answers
81
views
Create unique dataframe
For each city (here : NY, Chicago) I have 3 csv files with 2 columns like this :
file 1 : ID, 20101201
file 2 : ID, 20101202
file 3 : ID, 20101203
Each file name is like this : "...
1
vote
1
answer
145
views
Comparing Two Dataframes to See if One Sits Inside the Range of the Other's columns
I have 2 dataframes as follows:
import pandas as pd
import itertools
df_test = {
"col1": [1, 5, 6, 5],
"col2": [4, 5, 6, 7],
"col3": [5, 9, 10, 11],
&...
0
votes
2
answers
787
views
Use apply() instead of FOR loop to create dictionary from dataframe
How can I achieve the same result as in script below, but using some function and apply()? I know about list comprehensions, but it's only apply() without loops acceptable.
x_dict = {}
for indx, row ...
0
votes
2
answers
69
views
increasing row based on condition and retaining recent values based on groups
Please help out. i have a table below. I want to add 1 to val if cond = false and retain the new value for the next row if cond = True. Then add 1 to the retained value if condition = False again and ...
1
vote
1
answer
78
views
pd.fillna or pd.DataFrame.loc for NaN values by function with condition
Hi everyone? i white a function to replace NaN values in DataFrame (1750 000 lines):
def Android_iOs_device_os_cange(df):
def find_Android_brand(df):
list_for_android = list(df[df['...
0
votes
1
answer
28
views
how to convert function output into list, dict or as data frame?
My issue is, i don't know how to use the output of a function properly. The output contains multiple lines (j = column , i = testresult)
I want to use the output for some other rules in other ...
0
votes
1
answer
130
views
Creating a new column based on a condition in Pandas DataFrame
I would like to create a column that repeats the content in Col1 if it starts with "M " until it hits another row that starts with "M " and takes the value of that one and repeats ...
0
votes
1
answer
25
views
Iterating with conditions over Distinct Values in a Column
I have a dataset that looks something like this:
category
value
ID
A
1
x
A
0.5
y
A
0.33
y
B
0.5
z
B
0.33
z
C
5
w
C
0.33
w
For each category, I want to grab all the instances that have a value of <= ...
-1
votes
1
answer
31
views
Changing values with conditional and function in pandas/python
I have a dataframe, as per the table below A. I want to create a table with the values of table B.
I would like to compare the next value in the row with the previous value in table A.
If the next ...