Executing multiple python pandas dataframe methods on one csv
Question: I'm a bit new to programming in general. I've picked up a small project to
automate some csv changes via pandas dataframe.

I've been able to figure out a few of the changes I need to make,
unfortunately, when I print the current data frame, it only prints out the
changes from one of the functions and not the other (and vice-versa).

My code so far:

    
    
    import unicodecsv
    import datetime as dt
    from pandas import DataFrame
    
    # using Pandas for table view to rename '\xef\xbb\xbfId' to 'Id'
    df = pd.read_csv('Usage_sample.csv')
    df.rename(columns = {'\xef\xbb\xbfId':'ID'})
    
    # add column between ID and Client Name called "Usage Week Of"
    df.insert(1,"Usage Week Of", dt.datetime.today().strftime("%Y-%m-%d"))
    df
    

As you can see the two methods that I'm using is "rename" and "insert". Any
help would be much appreciated. Thanks!


Answer: Your `rename` does not have effect on `df` because it returns a new dataframe
which is not used. If you want to modify `df`, use `inplace`:

    
    
    df.rename(columns = {'\xef\xbb\xbfId':'ID'}, inplace=True)
    

