All Questions
91,495 questions
0
votes
0
answers
33
views
Continue colour flow to 3rd strand of a sankey diagram
I have created this code for a sankey diagram, but I can't get the colours to flow through the middle to the right side. Currently, the middle nodes act as aggregators, and each flow from a left-side ...
-1
votes
0
answers
34
views
Getting different results from Groupby for different sized Dataframes
I'm running the same functions on these two dfs that are identical except that they have different lengths (same number of columns and data types). When I run the larger one I get exactly as I would ...
1
vote
1
answer
39
views
Python Unit Test Side Effect Returns Function Instead of Value
I am working through creating unit tests for a Python application that handles data via Pandas DataFrames. One section of this application formats data in various DataFrame columns. I am looking to ...
1
vote
2
answers
70
views
How to select a range of data in a pandas dataframe
I have this pandas dataframe :
df :
import pandas as pd
data = {
"function": ["test1","test2","test3","test4","test5","test6",&...
0
votes
1
answer
83
views
How to compare every 2 rows(rows 1 and 2, rows 3 and 4, etc..) against eachother and output the results to a table
I am working on a project that requires me to compare 2 rows (1 and 2, 3 and 4, etc...) and output the differences to a table. Now I have been able to compare the columns and create the table with ...
0
votes
2
answers
84
views
Merge more than 2 dataframes if they exist and initialised
I am trying to merge three dataframes using intersection(). How can we check that all dataframes exists/initialised before running the intersection() without multiple if-else check blocks. If any ...
1
vote
1
answer
46
views
Down-sampling with Dask - Python
I'm trying to update the dependencies in our repository (running with Python 3.12.8) and stumbled across this phenomenon when updating Dask from dask[complete]==2023.12.1 to dask[complete]==2024.12.1:
...
1
vote
1
answer
56
views
Finding Numerical Relationships between Columns
I have selected a subset of numerical columns from a database and I want to iterate through the columns selecting a target_column and comparing it with the result of a numerical operation between two ...
3
votes
1
answer
59
views
How to properly extract all duplicated rows with a condition in a Polars DataFrame?
Given a polars dataframe, I want to extract all duplicated rows while also applying an additional filter condition, for example:
import polars as pl
df = pl.DataFrame({
"name": ["...
-1
votes
1
answer
34
views
Run a dataframe of URLs through a function - Python
I am trying to use a dataframe that contains a bunch of URLs and run each individual URL through a function. Note: the function works perfectly if called with a single URL i.e. myfunction(https://www....
0
votes
0
answers
42
views
Why does `groupby` return fewer rows than the number of unique rows after removing duplicates? [duplicate]
I'm working with a DataFrame df and trying to understand why the result of a groupby operation has fewer rows than expected. Here's what I did:
columnas = ["description", "surface_total&...
0
votes
0
answers
45
views
Apply float styling to specific rows in pandas dataframe [duplicate]
I've created a large dataframe with a smaller dataframe that represents a summary of some calculations run on the larger dataframe. This will find certain percentages, max/min of some columns, etc. I'...
0
votes
0
answers
22
views
Handling a priori on covariate variables for RNN
I am currently building my own dataloader for a deep learning project. The objective is to perform time series forecasting. As an exemple, let's assume I am forecasting weather, using the following ...
-3
votes
0
answers
67
views
When trying to index from a series, why it just showed one element instead of one row?
I am working on a python practice.
I am trying to filter out which occupation has the lowest average sleeping duration from data csv. Here is example code.
import pandas as pd
sleep_data = pd.read_csv(...
0
votes
1
answer
36
views
Combine dataframes fuzzy matching on time
I have two dataframes, dfA and dfB, whose primary key is an ID and a datetime object each stored in a column.
I wish to merge these dataframes on the ID & time if the ID is identical AND if the ...