👻 *Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!*

How do I take multiple lists and put them as different columns in a python dataframe? I tried this solution but had some trouble.

Attempt 1:

- Have three lists, and zip them together and use that
`res = zip(lst1,lst2,lst3)`

- Yields just one column

Attempt 2:

```
percentile_list = pd.DataFrame({"lst1Tite" : [lst1],
"lst2Tite" : [lst2],
"lst3Tite" : [lst3] },
columns=["lst1Tite","lst1Tite", "lst1Tite"])
```

- yields either one row by 3 columns (the way above) or if I transpose it is 3 rows and 1 column

How do I get a 100 row (length of each independent list) by 3 column (three lists) pandas dataframe?

👻 *Read also: what is the best laptop for engineering students?*

## Take multiple lists into dataframe percentile: Questions

How do I calculate percentiles with python/numpy?

1 answers

Is there a convenient way to calculate percentiles for a sequence or single-dimensional numpy array?

I am looking for something similar to Excel"s percentile function.

I looked in NumPy"s statistics reference, and couldn"t find this. All I could find is the median (50th percentile), but not something more specific.

Answer #1

You might be interested in the SciPy Stats package. It has the percentile function you"re after and many other statistical goodies.

`percentile()`

is available in `numpy`

too.

```
import numpy as np
a = np.array([1,2,3,4,5])
p = np.percentile(a, 50) # return 50th percentile, e.g median.
print p
3.0
```

~~This ticket leads me to believe they won"t be integrating ~~`percentile()`

into numpy anytime soon.