convert array into DataFrame in Python

后端 未结 2 876
情深已故
情深已故 2021-01-08 01:22
import pandas as pd    
import numpy as np   
e = np.random.normal(size=100)  
e_dataframe = pd.DataFrame(e)     

When I input the code above, I ge

2条回答
  •  清酒与你
    2021-01-08 01:57

    In general you can use pandas rename function here. Given your dataframe you could change to a new name like this. If you had more columns you could also rename those in the dictionary. The 0 is the current name of your column

    import pandas as pd    
    import numpy as np   
    e = np.random.normal(size=100)  
    e_dataframe = pd.DataFrame(e)      
    
    e_dataframe.rename(index=str, columns={0:'new_column_name'})
    

提交回复
热议问题