Skip to content

Tag: python

How to apply function for only special cells in column pandas?

I have a issue with applying function for column in pandas, please see below code : my df now show like below: I would like to apply function checknum for 2 cell in column ‘new’ which is having ‘None’ value. Can someone assist this ? Thank you Answer IIUC, you can use vectorial code: o…

Python – Unable to export sql result to Excel

I want to export sql query result to excel file using Python. I queried the DB and able to retrieve the result set.Currently what im facing is like.Not able write the query result to Excel, Here is my Code, When im running this code,its skipping to the except block.Is there anyway to figure out the issue? &#8…

Using groupby on already grouped data in Pandas

I would like to achieve the result below in Python using Pandas. I tried groupby and sum on the id and Group columns using the below: I got the first two columns, but I’m not sure how to get the third column (Overall_Total). How can I do it? Initial data (before grouping) id Group Time 1 a 2 1 a