147,800 questions
3
votes
2
answers
97
views
Pandas does not fail, warn, or skip when rows have more columns than the header
I'm new to Python and to Pandas, and I am desperately trying to understand how or why this is happening.
I have a CSV file with some data, which has some rows which have extra commas , which are not ...
-5
votes
0
answers
89
views
How to make a perfect dataframe without a syntax error [closed]
I want to know how I can insert many lists in a dataframe so that it won't show an error.
import pandas as pd
list1striker= []
n= 2 #strikers
fo=int(n)
for i in range(fo):...
3
votes
4
answers
129
views
Using multiple masks based on ID
I have a dataframe df that consists of two columns: an id, and a date. The id is a number from 1-3 & is not unique; the date is a datetime object.
id, date
1, 2020-5-11
1, 2019-3-2
2, 2018-7-29
3, ...
0
votes
0
answers
24
views
How to open a nested MatLab data in Python?
I have MatLab data and am trying to open it in Python data frame to conduct some statiscitcs. However RT variable (column) includes 60ish values, and I want them to be seperate: trial1, trial2... etc ...
0
votes
0
answers
67
views
How to find last occurences of certain column values in Data Frame for many such values in R? [closed]
I am looking to find the last message for a certain set of authors, that is, the last message for each one of the authors in a special set, and to return such final messages in a data frame.
I already ...
5
votes
3
answers
178
views
Pandas continous time periods
Given a table:
id
cost
from
to
43
4
2025-09-01 01:00:00
2025-09-01 01:30:00
42
4
2025-09-01 01:30:00
2025-09-01 02:00:00
41
4.8
2025-09-01 02:00:00
2025-09-01 02:30:00
40
4.05
2025-09-01 02:30:00
2025-...
2
votes
2
answers
235
views
Can a DataFrame have multiple, different types in the same column?
I have a DataFrame, as shown below. In order to build it, I started with adding the numbers (100 for spec A Sum in 2020 and so on).
Additionally I add the median as a date.
2020 ...
1
vote
1
answer
68
views
Combine separate plots into one plot in Python
I have created the following pandas dataframe:
ds = {
'Date' : ['2025-08-22 16:00:00', '2025-08-22 16:01:00', '2025-08-22 16:02:00', '2025-08-22 16:03:00', '2025-08-22 16:04:00', '2025-08-...
-1
votes
1
answer
89
views
How to sum up a particular row of number inputs in a DataFrame [closed]
I want to add the inputs in a particular row of data frame as total. But the output is
XYZ: OBJECT1 Object2
NUMBERS: 1 2
Where the inputted XYZ are Object2 and OBJECT1 and the inputted Numbers are 1 ...
3
votes
3
answers
134
views
splitting a data frame in a way like dealing cards
I have a data frame of students sorted by grade that I want to split into 3 data frames, such that an even number of students per grade is in each of the 3 groups. I thought of it like dealing cards, ...
1
vote
1
answer
154
views
Sorting a column of max values from a multicolumn pandas data frame
I have a multi-column pandas data frame of years and corresponding cumulative rainfall values from 1 to 183 (October to March). That means in each column the last value is the maximum column value, ...
-3
votes
0
answers
43
views
Erorr: 'numpy.ndarray' object has no attribute 'columns [closed]
Bengaluru House Pricing Model
So I was Trying to perform one hot encoding on the three columns of the data set ('area_type','availability','size') and all 3 columns has many sample values so i thought ...
-2
votes
1
answer
55
views
drop.na code doesn't show up when using print(data_frame) [duplicate]
I wanna delete missing values from a certain column:
#deleting rows with missing values
data_excel.dropna(subset=['Budget Betrag'])
then I wanna check whether it's working with
print(data_excel)
But ...
2
votes
1
answer
67
views
How to do linear interpolation in PySpark without Pandas UDF (only using Spark API)?
I have a Spark DataFrame with the following structure:
shock_rule_id
DATE
value
A
2024-01-01
100
A
2024-01-02
null
A
2024-01-03
130
B
2024-01-01
50
B
2024-01-02
null
B
2024-01-03
null
B
2024-01-04
80
...
7
votes
3
answers
394
views
How to sort pandas groups by (multiple/all) values of the groups?
I am trying to do a somewhat complicated group and sort operation in pandas. I want to sort the groups by their values in ascending order, using successive values for tiebreaks as needed.
I have read ...