Convert DataFrame to a List
DataFrames or Series are very useful data structures, but not all Python libraries use these types. So, you need to convert them to other Python types, such as a list. In previous lessons, we learned how to create Series and DataFrames from a Python list. Here, we see how to convert them back.
We'll cover the following...
Convert data to list without index
Both Series and DataFrame have a very simple function, tolist()
. From the name you can immediately tell what the function does.
You can call the function directly ...