So I have been working with a dataframe and converted it to long to wide setting a multi index.
df_wide = df.pivot_table(index = ["StationId", "day", "month", "year", "hour", "dayofweek"], columns = "minute", values = ["StationTotalFlow"])
I then used reset_index to reuse the columns I originally multi indexed.
df_wide = df_wide.reset_index()
My dataframe now looks like this(screenshot):
I would like to remove that minute index and... Using
df_wide.info()
I notice my column names are wrapped in parentheses.
Does anyone know what is going on?
It's not that they're "wrapped in parentheses" really, it's that you went from a MultiIndex to a single-level list of names, so the first level of the MultiIndex became the first element of each tuple, and the second level became the second element of each tuple.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments