DataFrame creation

A DataFrame is the most commonly used data structure in pandas. The constructor accepts many different types of arguments:

  • Dictionary of 1D ndarrays, lists, dictionaries, or Series structures
  • 2D NumPy array
  • Structured or record ndarray
  • Series
  • Another DataFrame

Row label indexes and column labels can be specified along with the data. If they're not specified, they will be generated from the input data in an intuitive fashion, for example, from the keys of dict (in the case of column labels) or by using np.range(n) in the case of row labels, where n corresponds to the number of rows.

A DataFrame can be created from a variety of sources as discussed in the following subsections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset