Reputation: 129
I’ve done quite a lot of searching around and seen many posts that explain the differences but I have not come across clear use cases. I do understand the differences in general but I would like to know why I should learn how to use Series when it seems that a single column Dataframe might perform everything a Series can.
Essentially I cannot extrapolate my understanding of their differences into “when I should use Series or Dataframe for a task in front of me?”.
Upvotes: 1
Views: 1583
Reputation: 71580
Here are my short explanations:
Series
: Series are for one-dimensional data, just like list
s with a lot of functions.
DataFrame
: DataFrames are for multi-dimensional data, just like nested list
s with a lot of functions.
Go to the docs to learn more.
Series
from the docs:
Series
is a one-dimensional labeled array capable of holding any data type (integers, strings, floating point numbers, Python objects, etc.). The axis labels are collectively referred to as the index.
DataFrame
from the docs:
DataFrame is a 2-dimensional labeled data structure with columns of potentially different types. You can think of it like a spreadsheet or SQL table, or a dict of Series objects. It is generally the most commonly used pandas object.
Upvotes: 5