[Tutor] pandas data frame
Peter Otten
__peter__ at web.de
Mon Jan 18 05:25:06 EST 2016
Bachir Bachir wrote:
[Bachir, please send your mails to the list, not to me. That way you
increase the likelihood to get a good answer]
>> On Sunday, January 17, 2016 4:20 PM, Peter Otten <__peter__ at web.de>
>> wrote:
>> Bachir Bachir via Tutor wrote:
>>> Hello EverybodyI need to sort a dataframe according to a specific column
>>> the create new dataframes according to the sorted columns each new
>>> created dataframe should contain the list(set('the sorted element)any
>>> help please, i am new in python and pandas thanks muchBachir
>>
>> Like this?
>>
>> >>> df
>>
>> foo bar
>> 0 3.3 b
>> 1 2.2 b
>> 2 7.5 a
>> 3 1.1 c
>> 4 4.7 a
>>
>> [5 rows x 2 columns]
>>
>> >>> df.groupby("bar").sum()
>>
>> foo
>> bar
>> a 12.2
>> b 5.5
>> c 1.1
>>
>> [3 rows x 1 columns]
> Thanks Peter ,This way but i want keep all the table elements only
> separate them by a single column
I'm sorry, I don't understand what you mean by "separate them by a single
column". Can you give an example? What exactly should the sorted version of
>> >>> df
>>
>> foo bar
>> 0 3.3 b
>> 1 2.2 b
>> 2 7.5 a
>> 3 1.1 c
>> 4 4.7 a
>>
>> [5 rows x 2 columns]
look like?
More information about the Tutor
mailing list