pandas create a series with n elements (sequential or randbetween)

前端 未结 2 675
一整个雨季
一整个雨季 2021-01-04 12:18

I am trying to create a pandas series.

One column of the series should contain n sequential numbers. [1, 2, 3, ..., n]

One colu

2条回答
  •  星月不相逢
    2021-01-04 12:46

    import pandas
    n = 30
    k = 40
    pandas.DataFrame([(i, random.randint(k, k+100), chr(random.randint(ord('A'), ord('Z')))) for i in xrange(0, n)
    

    If you want you specify the column names otherwise it is set to 0,1,2

提交回复
热议问题