Average counts in a column with condition of another column in Pandas [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have dataframe like this
enter image description here
I need to find out the average close days of request Recycling
Please help me.

You can group by request and get the average.This will give average for each group
df.groupby("request")["Days to Close"].mean()

Related

How can I get stock price data with a timeframe less than 1 minute? (Python) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 days ago.
Improve this question
I am looking for a way to use stock price data within micro timeframes. (30seconds, 15seconds, 1 second, milliseconds etc.)
I tried using the yfinance library. However, they do not have timeframes that are that small.

Calculate the 3 sigma value using python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have one data frame in python. How can I calculate the 3sigma value for each column of my data frame using python? please help me with this.
The command you're looking for is df.std() * 3

Trouble analysing spreadsheet using pandas python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Im trying to find a way to compare what students performed consistantly in their InternalAssessment_Performance to their FinalExam_Performance. Essentially i need to find what students have the same answer in both those columns.
How is it possible to compare the values in both commons and have them returned if they are the same?
Any help no matter how small would be great.
If the columns are aligned you can do something like this:
df[df['InternalAssessment_Performance'] == df['FinalExam_Performance']]

Time Series Calculation using pandas [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
What is the fastest method to write a function for time series calculation that counts consecutive values in the same series ? A For loop or vector
Here is what my data looks like:
enter image description here
You can use rolling function to calculate the sum of 4 consecutive hours
df.consumption4hr = df.Consumption.groupby(level='Accounts').rolling(window=4).sum()
with that you can just find the list of accounts that has 0 in that column. for example:
df[df.consumption4hr == 0].Accounts.unique()

Pandas: Multiply a column based on a different columns condition [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am using Python with Pandas. How can I multiply a column by 1000 given another column has a certain string?
This should do it.
df['columnname'] = np.where(df['othercolumn'] == 'CertainString',
df['columnname'] * 1000,
df['columnname'])

Categories

Resources