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
1 answer
9 views

How to add a time column that increments based on id column value in pandas?

I've an api endpoint that provides json data which when converted into a DataFrame looks something like this- index id name value time 1 101 A 12 00:12:00 2 101 ...
Snak's user avatar
  • 5
0 votes
0 answers
15 views

'Key Error' trying to Scrape Facebook with Selenium

I want to extract some data from my profile in Facebook and I'm using Chrome driver. I want to create a Data Frame with the names of people who Liked my posts and look at some metrics about them (like ...
Petros Christopoulos's user avatar
0 votes
0 answers
13 views

Assign a table from an excel spreadsheet to a variable, so i can paste it in a website using Selenium - Python

I'm looking to be able to assign a table from an excel spreadsheet to a variable, so that i can paste it in a text field in Selenium This is the code that i have tried It pasted the headers of the ...
Clay Burnett's user avatar
1 vote
1 answer
35 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
  • 279
3 votes
1 answer
28 views

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

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 string_1 =...
spg719's user avatar
  • 103
-1 votes
0 answers
46 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
26 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 ...
Codephree Coding's user avatar
0 votes
0 answers
21 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
18 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
0 votes
0 answers
16 views

Pandas interpolate on 2 missing values based on different columns and other specific filter function after groupby

After a groupby on a date column I would like to interpolate on 2 specific values based on different columns and also retrieve the value of another for which the sum of two columns is minimum ... I ...
Hotone's user avatar
  • 451
4 votes
0 answers
57 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
32 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
-3 votes
0 answers
45 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
107 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

15 30 50 per page