Difference between revisions of "Python, Excel Individual Commands"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
fig.show() | fig.show() | ||
''' active_posts has the data, username is a column also messages posted''' | ''' active_posts has the data, username is a column also messages posted''' | ||
==Sorting Data Output== | |||
'''Sorting in ascending order''' | |||
df.sort_values(by=['Brand'], inplace=True) | |||
'''Sorting in Descending order''' | |||
df.sort_values(by=['Brand'], inplace=True, ascending=False) | |||
'''Sort multiple columns''' | |||
df.sort_values(by=['Year','Price'], inplace=True) | |||
==[[#top|Back To Top]] - [[Python|Main Category]]/[[Python_Excel_Related| Excel Category]]== | ==[[#top|Back To Top]] - [[Python|Main Category]]/[[Python_Excel_Related| Excel Category]]== | ||
[[Category:Python]] | [[Category:Python]] |
Latest revision as of 18:29, 11 September 2020
Creating a pie chart from data
import plotly.express as px ## pip install plotly fig = px.pie(active_posts'username', 'Messages posted', values='Messages posted', names='username') fig.show()
active_posts has the data, username is a column also messages posted
Sorting Data Output
Sorting in ascending order
df.sort_values(by=['Brand'], inplace=True)
Sorting in Descending order
df.sort_values(by=['Brand'], inplace=True, ascending=False)
Sort multiple columns
df.sort_values(by=['Year','Price'], inplace=True)