Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Combine groupby() and shift() in pandas
Post: Combine groupby() and shift() in pandas

Hi, I have a following issue. I need to compute lagged means per groups in my dataframe. See following example: import pandas as pd df = pd.DataFrame(data={ 'name':["a","a","a","b","b","c" ] , 'valu...
rama27 Data Science 0 4,153 Nov-17-2020, 09:49 PM
    Thread: Pandas - compute means per category and time
Post: RE: Pandas - compute means per category and time

(Nov-12-2020, 04:49 PM)jefsummers Wrote: Not clear. Why is the 4th item, which is round 1, (5+1)/2? You have 2 round 1 entries by this time. And the 5th would be (4+2)/2? Still not getting how you a...
rama27 Data Science 7 3,419 Nov-12-2020, 07:32 PM
    Thread: Pandas - compute means per category and time
Post: RE: Pandas - compute means per category and time

(Nov-11-2020, 09:07 PM)jefsummers Wrote: How are you calculating those means? You only have 3 rounds. I kind of get the first 3 values in mean_per_round but do not see how you arrive at the last 3 v...
rama27 Data Science 7 3,419 Nov-12-2020, 11:47 AM
    Thread: Pandas - compute means per category and time
Post: Pandas - compute means per category and time

Hi, I have a following problem. I need to compute means per category and time (in my df named as a "round"). My simplified df looks like bellow: df = pd.DataFrame(data={ 'name':["a","a","a","b","b","...
rama27 Data Science 7 3,419 Nov-11-2020, 06:52 PM
    Thread: How to upload dfs using for loop?
Post: RE: How to upload dfs using for loop?

Thanks for reply, but I am afraid that your solution is not suitable for my case. I need to load dfs separately, exactly how I write.
rama27 General Coding Help 4 2,059 Nov-11-2020, 12:13 PM
    Thread: How to upload dfs using for loop?
Post: RE: How to upload dfs using for loop?

Thanks for reply! Yes, I am not doing this: df1 = df.loc[df['round'] == 1] df2 = df.loc[df['round'] == 2] df3 = df.loc[df['round'] == 3] df4 = df.loc[df['round'] == 4] df5 = df.loc[df['round'] == 5] ...
rama27 General Coding Help 4 2,059 Nov-11-2020, 11:00 AM
    Thread: How to upload dfs using for loop?
Post: How to upload dfs using for loop?

Hi, I have a following problem. I would like to define new data frames using a for loop. I have a big dataframe df that contains values from all 6 rounds. I need to have df1, df2, df3, ... ,df6 that w...
rama27 General Coding Help 4 2,059 Nov-10-2020, 04:58 PM
    Thread: How many times was the button pressed in pyglet
Post: How many times was the button pressed in pyglet

Hi, I have a following issue. I need to count how many times did I press any button on my keyboard. See following example: import pyglet @window.event def on_key_press( symbol, mod):     count = 0 ...
rama27 General Coding Help 0 1,888 Oct-10-2020, 10:26 AM
    Thread: How to append to list a function output?
Post: RE: How to append to list a function output?

Thank you @deanhystad for reply! My desired output is a list [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]. Of course, I know I can do it by list(range(0, 10)) , but this is just an example of something more compl...
rama27 General Coding Help 5 6,644 Aug-24-2020, 09:42 AM
    Thread: How to append to list a function output?
Post: How to append to list a function output?

Hi, I have a following issue. I need to append a function's output into a list. See a simplified code bellow: def output(n): i = n for i in range(0, n-1): i +=1 print(i) outp...
rama27 General Coding Help 5 6,644 Aug-23-2020, 07:03 PM
    Thread: Get html body of URL
Post: RE: Get html body of URL

Hi both, thanks for your replies! @Larz60+ I checked it, and the status code is really 200. import requests url = "https://www.sreality.cz/hledani/pronajem/byty/praha?velikost=1%2B1,2%2Bkk&stavb...
rama27 Web Scraping & Web Development 6 3,357 Aug-03-2020, 09:00 AM
    Thread: Get html body of URL
Post: Get html body of URL

Hi, I have a following issue. I would like to get HTML body of a webpage. I am beginning with Python, so to be clear - I need the same output as I get in Google chrome console using jquery command: &...
rama27 Web Scraping & Web Development 6 3,357 Aug-02-2020, 04:14 PM
    Thread: Append list into list within a for loop
Post: Append list into list within a for loop

Hi, I would like to append lists into one list in a for loop. See my code bellow: def triangle(n: int): pole = [] seznam = [] i = 0 j = 0 while j < n : whi...
rama27 General Coding Help 2 2,311 Jul-20-2020, 09:56 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020