Change it to list before assigning it to index
Copydf.index = list(df["First"])
Answer from Aman Singh Kamboj on Stack Overflowpython - dataframe, set index from list - Stack Overflow
python - pandas set_index() function returning None - Stack Overflow
How to set index of pandas dataframe in python? - Stack Overflow
why do I need .set_index when pulling columns from a dataframe?
Videos
When you're using inplace=True it will change the dataframe directly without returning the dataframe
So in your case it's either:
new_df = df.set_index('Close Time', drop=True)
print(new_df)
or
df.set_index('Close Time', inplace=True, drop=True)
print(df)
Can you show the output of the second one, since you said it didn't change it?
If you are reading from a file, use .read_csv(filename) to read the data frame. By the way, ignore the drop=True in your code as it is the default setting. So, it works just fine:
df.set_index('Close Time', inplace=True)
so a df named powerlifting_meets has a column indexed as MeetID, I want to create a var of just that column data
why do I need this ?
new = powerlifting_meets.set_index('MeetID')
why can't I just do this?
new = powerlifting_meets.MeetID OR new = powerlifting_meets['MeetID']
what purpose does the .set_index fills here? why is it being used a column name reference to get/pull the particular column in the df ?