Python-Pandas-DataFrame 如何把df变为以数据中的某一列为index
巴扎黑
巴扎黑 2017-04-18 09:58:55
0
2
564
巴扎黑
巴扎黑

reply all (2)
PHPzhong
  1. reindex isrearrangementbased on the new index. It is a rearrangement, not a modification of the index;

  2. For your questions, please refer to:

    df = pd.read_csv("510050.csv")
    The first column is "Date", the second to sixth columns are "Point", "ma5", "ma20", "ma60", "ma120" respectively

    df.index = df['Date'].tolist()

    洪涛

    http://pandas.pydata.org/pand...

    import matplotlib.pyplot as plt import numpy as np import pandas as pd df = pd.read_csv("510050.csv") df.set_index('date')
      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!