Posts

Showing posts with the label Series

Data Types and Structures in Pandas

  In Pandas, there are three primary data structures: Series, DataFrame, and Index. Series: A series is a one-dimensional array that is capable of holding any data type such as integers, strings, floating-point numbers, or Python objects. A series is similar to a column in a spreadsheet. It is defined using the pd.Series() function in Pandas. Example: kotlin Copy code import pandas as pd  data = [ 10 , 20 , 30 , 40 , 50 ]  s = pd.Series( data )  print(s) Output: go Copy code 0    10   1    20   2    30   3    40   4    50   dtype: int64 DataFrame: A DataFrame is a two-dimensional table that is capable of holding heterogeneous data types such as integers, strings, floating-point numbers, or Python objects. It is similar to a spreadsheet or an SQL table. A DataFrame is defined using the pd.DataFrame() function in Pandas. Example: kotlin Copy code import pandas as pd  data = { 'Name' : [ 'John' , 'Mike' , 'Sarah' , 'Jasmine' ], '