There is string 'pct', need variable pct - lambda function by removing '':

aggs = {'B':pct}
print(df.groupby('A').agg(aggs))

          B
A          
1  0.333333
4  0.333333
7  0.333333
Answer from jezrael on Stack Overflow
🌐
GitHub
github.com › dask › dask › issues › 4307
SeriesGroupBy Object has not Attribute Diff · Issue #4307 · dask/dask
December 17, 2018 - I have a multi-index DaskDataframe and am unable to compute a simple diff after a groupby operation on the dataframe. df.groupby('IndexName')['ColName'].diff() ..'SeriesGroupBy' object has no attribute 'diff The Dask Series object has a ...
Author   bgoodman44
Discussions

AttributeError: SeriesGroupBy object has no attribute ffill
Hi, I’m trying to convert some pandas code into Dask. In pandas, I can easily ffill my SeriesGroupBy object, toy example: import numpy as np import pandas as pd df = pd.DataFrame({ 'a_cat': list('aabbbaccc'), 'b_num': [np.nan if i%3!=0 else (i+1) for i in range(9)] }) df.groupby('a_cat')... More on dask.discourse.group
🌐 dask.discourse.group
3
0
February 10, 2022
Using isin() on grouped data
You need to use a boolean indexing because isin() is not compatible with a groupby object. I’m on mobile but here’s a link that will help you out https://stackoverflow.com/questions/50611929/python-pandas-groupby-isin More on reddit.com
🌐 r/learnpython
2
3
December 1, 2021
python - Error 'AttributeError: 'DataFrameGroupBy' object has no attribute' while groupby functionality on dataframe - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
python 3.x - In pandas, why I am getting error like "'SeriesGroupBy' object has no attribute 'Mean' - Stack Overflow
I have a dataframe with 2 columns and I am applying 'groupby' as per one column. Now I want to get the aggregate value for 'Sum', "Maximum' and "Minimum" using: df.groupby(["Col... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › pandas-dev › pandas › issues › 40139
ENH:AttributeError: 'SeriesGroupBy' object has no attribute 'kurtosis' · Issue #40139 · pandas-dev/pandas
March 1, 2021 - Code gives error: AttributeError: 'SeriesGroupBy' object has no attribute 'kurtosis' instead of correct group-wise kurtosis.
Author   rsuhada
🌐
GitHub
github.com › pandas-dev › pandas › pull › 60433
ENH: Support kurtosis (kurt) in DataFrameGroupBy and SeriesGroupBy by snitish · Pull Request #60433 · pandas-dev/pandas
DataFrameGroupBy and SeriesGroupBy currently support mean, std and skew (the first 3 moments) but not kurtosis (the 4th moment). This change addresses that. I implemented kurtosis in cython in similar fashion to skewness.
Author   pandas-dev
🌐
Narkive
pydata.narkive.com › tGpE0UQk › boxplot-and-groupby
boxplot and groupby
Post by ocefpaf Hi, I'm new to ... does not make much sense. But here it goes. I'm using groupby to aggregate my data by the columns "VESSEL" (a string with 8 names) and I'm getting the "START" (start time of each boat haul) like this. d = df.groupby('VESSEL')['START'] AttributeError: 'SeriesGroupBy' object has no attribute ...
🌐
Reddit
reddit.com › r/learnpython › using isin() on grouped data
r/learnpython on Reddit: Using isin() on grouped data
December 1, 2021 -

Hi,

I want to filter based on whether a value is in another column. However this data needs to be grouped before the isin filter in applied. When I do this I get the error

'SeriesGroupBy' object has no attribute 'isin'

Example explaining what I'm trying to do:

 import pandas as pd

dict = {'AttributeName': {0: 'John', 1: 'John', 2: 'John', 3: 'John', 4: 'Sally', 5: 'Sally'}, 'Lineage Step': {0: 1, 1: 2, 2: 3, 3: 4, 4:1, 5:2}, 'From Country': {0: 'Spain', 1: 'Scotland', 2: 'England', 3: 'England', 4: 'Scotland', 5:'England'}, 'From Town': {0: 'Madrid', 1: 'Edinburgh', 2: 'London', 3: 'London', 4: 'Edinburgh', 5: 'Manchester'}, 'FromStreet': {0: 'Spanish St', 1: 'Main St', 2: 'Lower St', 3: 'Middle St', 4: 'London St', 5: 'Scotland St'}, 'ToCountry': {0: 'Scotland', 1: 'England', 2: 'England', 3: 'England', 4: 'England', 5: 'England'}, 'ToTown': {0: 'Edinburgh', 1: 'London', 2: 'London', 3: 'London', 4: 'Liverpool', 5: 'London'}, 'ToStreet': {0: 'Lower St', 1: 'Middle St', 2: 'Upper St', 3: 'Upper St', 4: 'new St', 5: 'Old St'}}
sample_data = pd.DataFrame.from_dict(dict)

#example data set. I want to find every unique 'fromCountry' for both John and Sally. So For John we would just have the first row, where he enters from Spain to Scotland. The second row would be filtered as Scotland appears in the 'ToCountry' column. Sally would just have the 'FromCountry' Edinburgh row. 

I have tried to do like this:

sample_grouped = sample_data.groupby('AttributeName')
sample_grouped[~sample_grouped['From Country'].isin(sample_grouped['ToCountry'])]

but I get there error 'SeriesGroupBy' object has no attribute 'isin'

Does anyone know how to use the isin (or comparable) function on grouped by data?

Thanks

🌐
GitHub
github.com › pandas-dev › pandas › issues › 15082
Unclear ValueError on core.groupby · Issue #15082 · pandas-dev/pandas
def test_groupby_aggregate_item_by_item(self): def test_df(): s = pd.DataFrame(np.array([[13, 14, 15, 16]]), index=[0], columns=['b', 'c', 'd', 'e']) num = np.array([[s, s, s, datetime.strptime('2016-12-28', "%Y-%m-%d"), 'asdf', 24], [s, s, s, datetime.strptime('2016-12-28', "%Y-%m-%d"), 'asdf', 6]]) columns = ['a', 'b', 'c', 'd', 'e', 'f'] idx = [x for x in xrange(0, len(num))] return pd.DataFrame(num, index=idx, columns=columns) c = [test_df().sort_values(['d', 'e', 'f']), test_df().sort_values(['d', 'e', 'f'])] df = pd.concat(c) df = df[["e", "a"]].copy().reset_index(drop=True) df["e_idx"] = df["e"] what = [0, 0.5, 0.5, 1] def x(): df.groupby(["e_idx", "e"])["a"].quantile(what) self.assertRaisesRegexp(ValueError, "'SeriesGroupBy' object has no attribute '_aggregate_item_by_item'", x)
Author   ghost
Find elsewhere
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.Series.groupby.html
pandas.Series.groupby — pandas 3.0.2 documentation
If by is a function, it’s called on each value of the object’s index. If a dict or Series is passed, the Series or dict VALUES will be used to determine the groups (the Series’ values are first aligned; see .align() method). If a list or ndarray of length equal to the selected axis is passed (see the groupby user guide), the values are used as-is to determine the groups. A label or list of labels may be passed to group by the columns in self. Notice that a tuple is interpreted as a (single) key.
🌐
Stack Overflow
stackoverflow.com › questions › 46534653 › error-attributeerror-dataframegroupby-object-has-no-attribute-while-groupby
python - Error 'AttributeError: 'DataFrameGroupBy' object has no attribute' while groupby functionality on dataframe - Stack Overflow
Thanks for this...but I'm getting "AttributeError: 'SeriesGroupBy' object has no attribute 'sample'" at "df_sample = df.groupby("persons").sample(frac=percentage_to_flag, random_state=random_state)". If I can figure out why, maybe it'll work for me...
🌐
Google Groups
groups.google.com › g › pydata › c › 4ZjOP0Lfjdc
Problem with groupby and nth in pandas 0.18.1
July 5, 2016 - I noticed that you can also have the original behaviour of 0.17 by passing as_index=False: In [13]: df.groupby('device', as_index=False)['timestamp'].nth(0) Out[13]: 0 0 3 1 Name: timestamp, dtype: int64 Are you sure the transform('idxmin') works? I get an error when I try that (both on 0.17.1 as 0.18.1): AttributeError: 'SeriesGroupBy' object has no attribute 'idxmim' Whoops, there was a typo in your code, which is the cause that it failed: idxmim of course does not work, but idxmin does :-)  ·
🌐
GitHub
github.com › pandas-dev › pandas › issues › 11640
BUG AttributeError: 'DataFrameGroupBy' object has no attribute '_obj_with_exclusions' · Issue #11640 · pandas-dev/pandas
November 18, 2015 - In [5]: df.groupby('a').mean() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-29-a830c6135818> in <module>() ----> 1 df.groupby('a').mean() /home/nicolas/Git/pandas/pandas/core/groupby.py in mean(self) 764 self._set_selection_from_grouper() 765 f = lambda x: x.mean(axis=self.axis) --> 766 return self._python_agg_general(f) 767 768 def median(self): /home/nicolas/Git/pandas/pandas/core/groupby.py in _python_agg_general(self, func, *args, **kwargs) 1245 output[name] = self._try_cast(values[mask], result)
Author   nbonnotte
🌐
YouTube
youtube.com › watch
'SeriesGroupBy' object has no attribute 'pct'? - YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
Published   February 10, 2022
🌐
GitHub
github.com › pandas-dev › pandas › issues › 49907
BUG: SeriesGroupBy.apply sets name attribute if result is DataFrame · Issue #49907 · pandas-dev/pandas
November 25, 2022 - I have checked that this issue has not already been reported. I have confirmed this bug exists on the latest version of pandas. I have confirmed this bug exists on the main branch of pandas. def f(piece): return DataFrame({"value": piece, "demeaned": piece - piece.mean()}) df = pd.DataFrame({'a': [1,2,3], 'b': [4, 5, 5]}) res = df.groupby('a')['b'].apply(f) print(res.name) This prints 'b'. But .name shouldn't be an attribute of DataFrame... AttributeError: 'DataFrame' object has no attribute 'name'
Author   MarcoGorelli
🌐
GitHub
github.com › dask › dask › issues › 3438
Dataframe groupby()[column].agg fails with AttributeError · Issue #3438 · dask/dask
April 24, 2018 - AttributeError Traceback (most ...e.groupby.SeriesGroupBy) 1218 def agg(self, arg, split_every=None, split_out=1): -> 1219 return self.aggregate(arg, split_every=split_every, split_out=split_out) ~/applications/anaconda3/lib/python3.6/site-packages/dask/dataframe/groupby.py in aggregate(self, arg, split_every, split_out) 1211 1212 if not isinstance(arg, (list, dict)): -> 1213 result = result[result.columns[0]] 1214 1215 return result AttributeError: 'Series' object has no attribute ...
Author   joergdietrich
🌐
Reddit
reddit.com › r/dataanalysis › data analysis in python
r/dataanalysis on Reddit: Data Analysis in Python
December 19, 2022 -

Hello everyone!
I am a newbie at python and I looked up some problems associated with the Data Expo 2009: Airline on time data from the Harvard Dataverse (https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/HG7NV7).
I am currently working on the following question:

  1. When is the best time of day, day of the week, and time of year to fly to minimize delays?

All libraries are imported and the data is cleared up (empty columns and duplicate rows are dropped).
What I was intending to do is to plot a bar chart with "Months" on the x-axis and "ArrDelay" (arrival delays) on the y-axis.

My code looks the following way (I'm using jupyter notebook):

import pandas as pd 
dataair = pd.read_csv("/Users/issakovakamilla/Desktop/2000.csv.bz2")
dataair.dropna(how='all', axis=1, inplace=True)
dataair
import matplotlib.pyplot as plt
df = pd.DataFrame(dataair)
X = list(df.iloc[:, 0])
Y = list(df.iloc[:, 1])
plt.bar(X, Y, color='g')
plt.title("stats")
plt.xlabel("Month")
plt.ylabel("ArrDelay")
plt.show()

Somehow I don't get a plot - its been executing for 10 minutes now (I get * near input). Could anyone help me with this?