289,232 questions
0 votes
0 answers
26 views
Suitable Pandas installation on 32-bit Python (3.10, 3.11)
I am trying to use the Kiwoom OpenAPI (for making automated stock trading program), which requires a 32-bit Python environment. However, to successfully use Kiwoom Open API I need to set up pandas in ...
0 votes
3 answers
60 views
How to modify mulitple columns applying if else to multiple pandas dataframe columns
I have a dataFrame with columns Age, Salary and others, if I used: df['Age'] = df['Age'].apply(lambda x : x+100 if x>30 else 0) Then I can modify the Age column with the if else condition. Also, if ...
3 votes
1 answer
110 views
Use pandas merge_asof to achieve inexact left join
I have two pandas series: right_series Index Value 1 0.1 2 0.2 3 0.3 6 0.6 7 0.7 left_series Index Value 1 0.1 5 0.5 10 1.0 I would like to join right_series on left_series by the indices, such that ...
0 votes
1 answer
81 views
Why does groupby().apply() produce inconsistent results on identical groups when the DataFrame has overlapping indices?
I noticed that groupby().apply() produces different results for two groups that look identical, except that the overall DataFrame has duplicate index values. Here is a minimal reproducible example: ...
-1 votes
1 answer
68 views
Using list to find variables from data in rows [closed]
I am trying to find a combination where it will go through the data to find matched variables for any value from the list First_row is found, any value from the list Second_row and any value from the ...
Advice
1 vote
3 replies
126 views
Best way to clean awkward Excel column headers in python/pandas?
I've got four years of daily school attendance data spread across 40+ Excel files (one for each month) and the sheets are set up in a truly annoying fashion, with each date in one merged cell in the ...
2 votes
4 answers
149 views
How to split dataframe into multiple sub-dataframes based on column value
I got a dataframe df1 which looks like this: Column1 Column2 13 1 12 1 15 0 16 0 15 1 14 1 12 1 11 0 21 1 45 1 44 0 The 1s indicate that a measurement started, I don't know how many 1s will be in one ...
5 votes
2 answers
105 views
How to resample timeseries with origin aligned to start of year
Consider the following pandas Series with a DatatimeIndex of daily values (using day-of-year as an example): import pandas as pd dti = pd.date_range("2017-11-02", "2019-05-21", ...
0 votes
2 answers
92 views
How to Create a Pandas Dataframe from JSON Nested Objects [closed]
I'm trying to create a Pandas DataFrame from a JSON file that looks like this: { "GameID": "1,218,463,841", "Date - Start": "1761097369", "Date - End&...
1 vote
1 answer
109 views
Pandas converts Excel strings like ‘2004E205’ to scientific notation — how to prevent this
How can I handle string values that contain patterns like xxxE205 (e.g., 2004E205), which are used as unique codes in my company? I explicitly read the column as a string in pandas, but values ...
Tooling
0 votes
2 replies
67 views
How to export or import TOON in pandas?
I would like to know how to export or import TOON (Token object oriented notation) in pandas.
2 votes
1 answer
129 views
Problem converting a column to datetime format
I have a data frame and I am trying to convert the time column into a datetime format. The first step I did was: data['time'] = data.time data['time']=pd.to_datetime(data['time'], format='%H:%M:%S.%f')...
3 votes
2 answers
210 views
Efficiently get first indices of consecutive identical digits in big pandas DataFrames
I have a DataFrame with a column Digit of digits at base 10. For example import numpy as np import pandas as pd df = pd.DataFrame({ "Digit": [ 1, 3, 5, 7, 0, 0, 0, 4, 8, ...
0 votes
1 answer
87 views
How to count appearance of all items in a row on Pandas Dataframe [closed]
II'm currently learning the Pandas library in Python (without AI assistance), and in one of my tasks I needed to count how many times each item appeared in a row of a DataFrame. Here's an example of ...
2 votes
1 answer
73 views
problem on the x-axis of the graph, doesn't render the time
I am working on a dashboard using Shiny for Python and Plotly Express. I am trying to create a Gantt chart (using px.timeline) to visualize the operating periods of different boilers (ON/OFF states). ...