Skip to main content

Questions tagged [pandas]

Pandas is a Python library for data manipulation and analysis, e.g. dataframes, multidimensional time series and cross-sectional datasets commonly found in statistics, experimental science results, econometrics, or finance. Pandas is one of the main data science libraries in Python.

pandas
0 votes
0 answers
13 views

Complicated triple sum in pandas dataframe

I have a pandas dataframe that looks like import pandas as pd data = { "Race_ID": [1,1,1,2,2,2,2,2,3,3,3,4,4,5,5,5,5,5,5], "Student_ID": [3,5,4,1,2,3,4,5,4,3,7,2,3,9,10,2,3,6,...
Ishigami's user avatar
  • 267
1 vote
1 answer
15 views

Polars apply function to check if a row value is a substring of another string

Hello I'm trying to check if string_1 = 'this example string' contains a column value as a substring. For example the first value in Col B should be True since 'example' is a substring of string_1 ...
spg719's user avatar
  • 83
-1 votes
0 answers
41 views

Pandas : Merge Two Dataframe using Condition

I Have a question about how to merge dataframe using conditon. I have two dataframe df1 Pro fg material_df1 qty_df1 1 f01 m01 1 1 f01 m02 1 1 f01 m03 1 1 f01 m05 1 2 f01 m01 2 2 ...
Joni Wekin's user avatar
0 votes
0 answers
22 views

Convert List of JSON to Dataframe to Multiple Excel Sheets

I have list of multiple objects that I want to convert into excel and I need individual object to be on different sheets. I have looped the list then to convert to Dataframe see below list of json I ...
Odeleye Oluwafemi's user avatar
0 votes
0 answers
20 views

Showing one x tick per month on a pandas plot

I have a time series with daily data, that I want to plot, and only plot a x-tick every month. I have tried multiple approaches (including the ones described here, but it seems that pandas considers ...
meto's user avatar
  • 3,637
-1 votes
0 answers
17 views

Plotly line graph doesn't display properly on google colab

Graph doesn't display according to designated dates. Tried to create a automated plotly line graph to convert csv files to PNG format import pandas as pd import plotly.express as px def present_line(...
Onyinyechukwu Orji's user avatar
4 votes
0 answers
52 views

How to vectorize groupby combination lists of two columns in Pandas Dataframe

I've a dataframe and need to group by two columns from all possible combinations of dataframe columns ['A','B','C','D','E','F','G'] import pandas as pd d = {'A': [0,1,1,0,0,1,0,0], 'B': [1,1,0,0,...
black cat's user avatar
0 votes
1 answer
31 views

web scraping table using pandas

I am learning web scraping on a course on coursera. I tried the code given in the course on my Mac (I use PyCharm by the way) but I got many errors. I guess it has to do with missing libraries or ...
Anas Zahra's user avatar
-2 votes
0 answers
42 views

How to set values in a dataframe column that depends if another column value is bigger than a dict/lookup table

I have a dataset with date and id columns, and I want to set a third column 'Status' where if the date is before the value in the dict/lookup table, then 'On', 'Off' if on or after the date. For ...
yungkenny's user avatar
7 votes
1 answer
92 views

Translate Pandas groupby plus resample to Polars in Python

I have this code that generates a toy DataFrame (production df is much complex): import polars as pl import numpy as np import pandas as pd def create_timeseries_df(num_rows): date_rng = pd....
girdeux's user avatar
  • 700
-2 votes
0 answers
42 views

Mismatched dataframe rows in python

I'm trying to convert sql code to python, where inner join is being used. SQL CODE- Update A Set A.ID_New = B.[ID], A.Type_New = B.[Type] From ABC A inner join XYZ B on A.[1] = B.[1], and A.[2] = B.[...
Angel's user avatar
  • 7
1 vote
1 answer
36 views

Convert TSV file data to a dataframe, which can be pushed to database

We have TSV files which holds IOT data, want to convert to table like structure using pandas. I have worked on TSV data, similar to given below, were the logics goes like read the file Add new column ...
Kavya shree's user avatar
0 votes
1 answer
44 views

Python code unable to save to existing folder

I've been writing some code that takes a series of Excel files as an input, and then saves a dataframe to an excel as an output. Both the input and output folders sit on a network drive, where ...
Arthcode's user avatar
0 votes
2 answers
56 views

Speed-up literal_eval in a DataFrame apply

I have a pandas DataFrame with the following columns: id | value | somedate ------------------------------ 1 | [10, 13, 14] | 2024-06-01 2 | [5, 6, 7] | 2024-07-01 3 | [1, 2, 3] | 2024-...
abudis's user avatar
  • 2,867
-1 votes
2 answers
40 views

Pandas alignment error during elementwise comparison [duplicate]

When checking element-wise equality of multiple columns of a dataframe against a single column, pandas raises a ValueError: Operands are not aligned. Do 'left, right = left.align(right, axis=1, copy=...
silence_of_the_lambdas's user avatar

15 30 50 per page
1
2 3 4 5
19193