Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sorting table data
#1
Hi everyone,

I've a difficulties with my project, I'm a novice in Python. I would like sort my column "TypeDOC" in descending order but it's not possible because of my index I think. Would you have an idea to solve my problem ?

df3 = pd.DataFrame(data=list(liste01.typeconsultation), index=liste01.iddoc, columns=['TypeDOC'])
df3 = df3[df3['TypeDOC'] == 'document']
df3['IdDOC'] = df3.index

tableau4 = pd.pivot_table(df3, index='IdDOC', values='TypeDOC', aggfunc='count')
tableau4.sort_values(by = 'TypeDOC')
tableau4
Thanks to all those who will take the time to answer me !
Reply


Messages In This Thread
Sorting table data - by Blacktime2 - Feb-26-2022, 12:57 PM
RE: Sorting table data - by ibreeden - Feb-26-2022, 07:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using pyodbc&pandas to load a Table data to df tester_V 3 858 Sep-09-2023, 08:55 PM
Last Post: tester_V
  panda table data kucingkembar 0 1,145 Mar-01-2022, 10:38 PM
Last Post: kucingkembar
  Strategy on updating edits back to data table and object variables hammer 0 1,215 Dec-11-2021, 02:58 PM
Last Post: hammer
  SQLALCHEMY - Not selecting data from table jamesaarr 4 2,275 Nov-02-2021, 03:02 PM
Last Post: Larz60+
  SaltStack: MySQL returner save less data into Database table columns xtc14 2 2,212 Jul-02-2021, 02:19 PM
Last Post: xtc14
  Need help on extract dynamic table data Dr_Strange 0 2,511 Apr-30-2021, 07:03 AM
Last Post: Dr_Strange
  Load the data from multiple source files to one table amy83 2 2,621 Apr-27-2021, 12:33 AM
Last Post: Pedroski55
  Yahoo_fin, Pandas: how to convert data table structure in csv file detlefschmitt 14 7,898 Feb-15-2021, 12:58 PM
Last Post: detlefschmitt
  Sorting data pprod 4 2,713 Feb-01-2021, 06:51 PM
Last Post: paul18fr
  Data extraction from a table based on column and row names tgottsc1 1 2,430 Jan-09-2021, 10:04 PM
Last Post: buran

Forum Jump:

User Panel Messages

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