top of page

Excel Arena

This is the place, where we can test the boundaries of Excel functions.

Basic Data Transformations - Python in Excel:

Apply Filter and Select Desired Columns:


Filter Criteria - Percentage is Greater than 35.

Desired Column - Country.

We can provide multiple column names inside list.



df = xl("A1:B10", headers=True)

df.loc[ df['Percentage'] > 0.35, ['Country']].reset_index(drop=True)


Sort a Table with Multiple Criteria:


Criteria-1: Percentage column in Descending Order.

Criteria-2: Country column in Ascending Order.



df = xl("A1:B10", headers=True)

df.sort_values(by = ['Percentage','Country'], ascending = [False, True]).reset_index(drop=True)


Remove repeated consecutive values:


The opposite operation to the Fill Down approach.

Remove repeated consecutive values in Qtr and Month Column.



df = xl("B2:D14", headers=True)

df.mask(df.apply(lambda col: False if col.name == 'Sales' else col.duplicated()),'')

Comments


  • LinkedIn
  • Facebook
  • Twitter
  • Instagram
bottom of page