Skip to main content

All Questions

0 votes
1 answer
42 views

Approaches To Optimize Nested For Loops and Dataframe Creation?

I am not very experienced with coding but I am creating a customtkinter application style script where a user can input a specific type of html that contains diagnostic addresses and various ...
Chickchu's user avatar
0 votes
1 answer
86 views

How to replace nested for loops with apply from dataframe in python

I have a dataframe and a list below. import pandas as pd my_df = pd.DataFrame({'fruits': ['apple', 'banana', 'cherry', 'durian'], 'check': [False, False, False, False]}) ...
GH KIM's user avatar
  • 316
0 votes
1 answer
77 views

Manipulate data in a DataFrame

I am very new to Python, so please bear with me. I have this dataframe called df_staging (sample image) that summarizes the annual sales and income for multiple counties (A1,A2,A3,A4,etc.). I want to ...
Kendo96's user avatar
  • 15
0 votes
1 answer
121 views

Handling Occasional 100 MB API Responses in FastAPI: Polars vs. NumPy/Pandas?

I'm working on an asynchronous FastAPI project that fetches large datasets from an API. Currently, I process the JSON response using a list comprehension and NumPy to extract device IDs and names. For ...
Foxbat's user avatar
  • 362
0 votes
1 answer
73 views

pandas Iterate columns and rows in a dataframe to get the output straing of the combination in to a list

I have a dataframe like below data = {'col7': ['Apple','Banana','-','-','-','-'],'col6': [float('NaN'),float('NaN'),'-','-','-','HA'],'col5': [float('NaN'),float('NaN'),'-','-','-','HB'],'col4': [...
Josephine Fang's user avatar
0 votes
3 answers
70 views

For loop in dataframe column

I want to iterate through dataframe column, ['Status'], and based on value calculate days since date in column ['Date'] and write to a third column,['Days']. import pandas as pd from datetime import ...
slabbe's user avatar
  • 19
1 vote
1 answer
62 views

Python How to Select to List All DataFrame Rows where Column has a NaN Entry

I have a DataFrame (20k rows) with 2 columns I would like to update if the first column (latitude) row entry is NaN. I wanted to use the code below as it might be a fast way of doing it, but I'm not ...
CGarden's user avatar
  • 349
1 vote
1 answer
65 views

Using for-loops to process multiple pandas dataframes

I'm processing many dataframes and want to remove null and negative values using a for-loop. The python code seems like it should work, but it doesn't. I'm wondering why this logic doesn't work in ...
Dave's user avatar
  • 65
2 votes
1 answer
38 views

How to delete all rows below after specific symbol and for each id

This is my dataframe: id url 25 google.com/main 25 google.com/buy 25 google.com/videos 144 google.com/buy 144 google.com/videos 144 google.com/...
Stepan P.'s user avatar
1 vote
0 answers
88 views

Optimize loops in Numpy correlation matrices

I have a piece of code to calculate price sensitivity based on the product and its rating. Below is the original data set with product type, reported year, customer’s rating, price per unit, and ...
Laura's user avatar
  • 97
0 votes
1 answer
30 views

How do I fill missing values in a dataframe with the values found in another dataframe using a lookup value? [duplicate]

Basically, I have a df with car model+year as a string in 1 column. The dataframe is a collection of used cars for sale so there are duplicate model+year rows but not duplicated entire rows. In this ...
Dalv32's user avatar
  • 1
1 vote
2 answers
35 views

Create dataframes with parametrized names [duplicate]

I have a dataframe like: df name value 0 a 10 1 a 5 2 b 4 3 b 8 I want to create filtered datasets using the 'name' feature. Something like: for i in ['a', 'b']: df_{i} = ...
Fernando Quintino's user avatar
-1 votes
2 answers
47 views

Loop and store muliple paths Pandas

Goal: Parameterize multiple paths and merge all data on ID using pandas. For example, I have multiple paths below: \Users\Documents\202301\data01.pqt \Users\Documents\202302\data02.pqt \Users\...
gfgd's user avatar
  • 33
0 votes
2 answers
91 views

Comparing data from two dataframes and filtering them

I've recently worked on a project in which I use pandas dataframes to store data. I've currently got two dataframes containing odds from sportsbookies for football games, with this data I want to ...
nijhof.ngsvn's user avatar
1 vote
1 answer
32 views

Resolving multiple Python data frames within single object

I'm attempting to loop through multiple pages (2 for the purposes of this example) of a website, scrape relevant customer reviews data, and ultimately combine into a single data frame. The challenge I'...
David Reynolds's user avatar

15 30 50 per page
1
2 3 4 5
72