pass list of columns names in pandas

Solutions on MaxInterview for pass list of columns names in pandas by the best coders in the world

showing results for - "pass list of columns names in pandas"
Amanda
13 Apr 2019
1>>> import pandas
2>>> # create three rows of [0, 1, 2]
3>>> df = pandas.DataFrame([range(3), range(3), range(3)])
4>>> print df
5   0  1  2
60  0  1  2
71  0  1  2
82  0  1  2
9>>> my_columns = ["a", "b", "c"]
10>>> df.columns = my_columns
11>>> print df
12   a  b  c
130  0  1  2
141  0  1  2
152  0  1  2
16