pandas primarily uses two Data Structures, Series and DataFrame.

## Series

`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**. The basic method to create a Series is to call:

Syntax: `s = pd.Series(data, index=index)`

Here, `data`

can be many different things:

- a Python dict
- an ndarray
- a scalar value (like 5)

The passed **index** is a list of axis labels. Thus, this separates into a few cases depending on what **data is**:

eg using ndarray: `s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e'])`

- Here pd is pandas and np is numpy
- random.randn(5) is API in numpy to generate random numbers
- 5 random numbers are generated and corresponding element in index clause act as index to each of these 5 numbers
- We can access each of these elements using variable with index eg:
`s['a']`

eg using dict: `d = {'a' : 0., 'b' : 1., 'c' : 2.}`

- In this case we are directly specifying index and values
- We can access each of these elements using variable with index eg:
`d['a']`

`pd.Series(d, index=['b', 'c', 'd', 'a'])`

– If there are more elements in the index, then corresponding value will be NaN- NaN is standard missing data marker used in pandas

## DataFrame

**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. Like Series, DataFrame accepts many different kinds of input:

- Dict of 1D ndarrays, lists, dicts, or Series
- 2-D numpy.ndarray
- Structured or record ndarray
- A
`Series`

- Another
`DataFrame`

Along with the data, you can optionally pass **index** (row labels) and **columns** (column labels) arguments. If you pass an index and / or columns, you are guaranteeing the index and / or columns of the resulting DataFrame. Thus, a dict of Series plus a specific index will discard all data not matching up to the passed index.

If axis labels are not passed, they will be constructed from the input data based on common sense rules.

Example of creating DataFrame using dict

## Start the discussion at discuss.itversity.com