1

I am learning Python. As far as I understand, Pandas includes Series and DataFrame data structures. It seems to me that Series is just a DataFrame with one column (along with the index column). Why then, do we need the Series data structure? Is the DataFrame not enough?

Brad Solomon
  • 38,521
  • 31
  • 149
  • 235
Abe
  • 11
  • 4
  • you can consider a DataFrame as a collection of Series ;-) – MaxU - stand with Ukraine Dec 05 '17 at 14:23
  • Certain operations were written to only work on Series objects. It's not safe to assume you don't have multiple dimensions when all you have is a Dataframe – OneCricketeer Dec 05 '17 at 14:24
  • 1
    `It seems to me that Series is just a DataFrame with one column`, no thats not true. – Bharath M Shetty Dec 05 '17 at 14:29
  • it's a developer choice. Like matlab deals essentially with matrix, numpy use 0,1,2,N dims array. You find the same in pandas. – B. M. Dec 05 '17 at 14:29
  • Have a look at this [answer](https://stackoverflow.com/questions/26047209/what-is-the-difference-between-a-pandas-series-and-a-single-column-dataframe) – DimKoim Dec 05 '17 at 14:50
  • Possible duplicate of [What is the difference between a pandas Series and a single-column DataFrame?](https://stackoverflow.com/questions/26047209/what-is-the-difference-between-a-pandas-series-and-a-single-column-dataframe) – ababuji Dec 05 '17 at 14:55
  • Thanks for the answers – Abe Dec 09 '17 at 17:55
  • Using a Series simplifies things when appropriate to use. When you use a Series, you know by heart that it only has an index and a data column. You don't need to worry about the number of columns, their respective data types, which column holds which data, etc. like in a DataFrame. – Alper Jun 01 '22 at 18:32

0 Answers0