I have a DataFrame
that looks like
Emp1 Empl2 date Company
0 0 0 2012-05-01 apple
1 0 1 201
When you pass inplace in makes the changes on the original variable and returns None, and the function does not return the modified dataframe, it returns None.
is_none = df.set_index(['Company', 'date'], inplace=True)
df # the dataframe you want
is_none # has the value None
so when you have a line like:
df = df.set_index(['Company', 'date'], inplace=True)
it first modifies df
... but then it sets df
to None!
That is, you should just use the line:
df.set_index(['Company', 'date'], inplace=True)