Answers for "python pandas columns to list"

8

python - convert a column in a dataframe into a list

myvar_list = df["myvar"].tolist()
Posted by: Guest on September-01-2020
1

pandas dataframe lists as columns

In [8]: data = pd.DataFrame({'x': x, 'sin(x)': y})
In [9]: data
Out[9]: 
          x        sin(x)
0  0.000000  0.000000e+00
1  0.349066  3.420201e-01
2  0.698132  6.427876e-01
3  1.047198  8.660254e-01
4  1.396263  9.848078e-01
5  1.745329  9.848078e-01
6  2.094395  8.660254e-01
7  2.443461  6.427876e-01
8  2.792527  3.420201e-01
9  3.141593  1.224647e-16

[10 rows x 2 columns]
Posted by: Guest on June-05-2020

Code answers related to "python pandas columns to list"

Python Answers by Framework

Browse Popular Code Answers by Language