Using R, how do I make a column of a dataframe the dataframe\'s index? Lets assume I read in my data from a .csv file. One of the columns is called \'Date\' and I want to ma
The index can be set while reading the data, in both pandas and R.
In pandas:
import pandas as pd df = pd.read_csv('/mydata.csv', index_col="Date")
In R:
df <- read.csv("/mydata.csv", header=TRUE, row.names="Date")