I have a random dataframe with multi index as such:
import numpy as np
from itertools import product
import pandas as pd
c1 = np.arange(3,5,1)
c2 = np.arange(7,9,1)
c3 = np.arange(0,135,45)
df= pd.DataFrame(list(product(c1, c2, c3)), columns=['c1', 'c2','c3'])
df['c4'] = df.index
df = df.set_index(['c1', 'c2','c3'])
When I save the dataframe to csv, I get a csv with duplicate values within the MultiIndex c1,c2,c3. I want to have only the unique values of c1, c2 occuring once in the csv file since they all occur successively. How can I mask these values in Pandas before saving it to csv?