Skip to main content
0 votes
1 answer
13 views

Get certain value from column with varying row index in Pandas

I am using Pandas to process numerous Excel files and I need to extract certain values from columns. The position within the column (the row) may vary but the name of the column remains the same ...
Kai's user avatar
  • 327
0 votes
1 answer
14 views

Write pandas dataframe to excel consume too much memory

I am using this code to write a dataframe into excel file: with pd.ExcelWriter(file_data, engine='xlsxwriter',engine_kwargs={"options": {"strings_to_formulas": False}}) as writer: ...
Tiancheng Liu's user avatar
-3 votes
1 answer
20 views

Str.Contains in Pandas

I have a dataset as below where Coffee type = ['Robusta/Arabica','Arabica/Robusta','Arabia','Robusta'] How can I filter on rows which only contain 'Robusta'? I tried to use str.contains('Robusta') ...
Mỹ Trần's user avatar
-1 votes
0 answers
19 views

Categorical Dtype

Why in: cat = pd.Categorical( values=['a', 'b', 'd', 'f'], categories=['b', 'a', 'c', 'd', 'e', 'f'], ordered=True ) cat.dtype The Dtype output is 'object' and not 'category'. ...
Mohamad Osama's user avatar
0 votes
0 answers
13 views

API changes when using app_store_scraper in Python?

Last summer, I created code for scraping Apple podcast reviews based on the official documentation provided for app-store-scraper: https://pypi.org/project/app-store-scraper/ Here is the relevant ...
OnceUponATime's user avatar
0 votes
1 answer
24 views

Selecting multiple columns (`MultiIndex` based) within a `DataFrameGroupBy` in Python

I have a complex dataframe with multiple columns. All of them being MultiIndex based. At some point I wanted to be quite specific when it comes to estimating some metrics so I started experimenting ...
Manu's user avatar
  • 70
0 votes
1 answer
19 views

How and why does Python's built-in round() function work flawlessly with pandas?

I have difficulty in understanding the following behavior of Python's built-in "round" function: Round doesn't work with lists: round([1.345, 2.718], 2) # Raises TypeError Round doesn't ...
Musa H. Asyali's user avatar
0 votes
0 answers
15 views

Return an Error Message in Plotly Dash and place at the top of the page

I have a fairly complex visualization tool I created in Plotly Dash, so I won't share the entire code, though what I am trying to do is return an error message using a try/except block. except ...
John Conor's user avatar
0 votes
1 answer
17 views

How to save all Plotly express graphs created using a for loop in a PDF?

I am trying to save all the charts generated through a for loop in a SINGLE PDF file. My sample data: import pandas as pd import numpy as np import plotly.io as pio import plotly.express as px import ...
Karthik S's user avatar
  • 11.5k
0 votes
0 answers
10 views

Banding function showing 'none' values instead of defined values in Pandas [duplicate]

I'm trying to band years into decades to make visualisation clearer and my function appears to work initially: def banding(year): if year <= 1989: print ('1980s') ...
Amy Santos's user avatar
1 vote
1 answer
37 views

how do you select the maximum value accross each row in pandas

Hi have this data frame: Server 1-Jun 6-Jun 1-jul Jul-10 ServerA 8 9 5 90 ServerB 100 10 9 90 I need to create another column called maximumval and pick ...
user1471980's user avatar
  • 10.6k
0 votes
0 answers
39 views

Move or copy data from one column into another column [duplicate]

All I want to do is grab all the data in column "Name 2" and "Lastname 2" and move it under the data in column "Name 1" and "Lastname 1" respectively, and bring ...
Pietro Aretino's user avatar
0 votes
0 answers
16 views

conda envs in jupyter and shell seem different

I have a python environment ml on a server. I connect to the server via Visual Studio Code and related extensions. The ml environment uses Python 3.10.14. I have this problem: when I run Jupyter ...
Antonio Sesto's user avatar
-4 votes
1 answer
41 views

Ubuntu 22.04 syntax warning importing Pandas

I have installed Python 3.12 in Ubuntu 22.04 alongside the system Python 3.10. It works as expected as do packages such as Numpy. However after installing Pandas 2.2.2 the line import pandas as pd ...
user19077881's user avatar
  • 5,273
1 vote
1 answer
38 views

Group by Number, different size groups

I have a dataset where i show ticket purchases by number of days out from event (NDO). NDO Purch Country 0 3 UK 1 3 UK 1 3 UK 1 3 USA 2 3 USA I want to split the data in groups by NDO, eg 0 ...
niallygee's user avatar

15 30 50 per page