Python, Excel Individual Commands

From rbachwiki
Jump to navigation Jump to search

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)

Back To Top - Main Category/ Excel Category