PYnative

Python Programming

  • Learn Python
    • Python Tutorials
    • Python Basics
    • Python Interview Q&As
  • Exercises
    • Python Exercises
    • C Programming Exercises
    • C++ Exercises
  • Quizzes
  • Code Editor
    • Online Python Code Editor
    • Online C Compiler
    • Online C++ Compiler
Home » Python » Pandas » Pandas DataFrame

Pandas DataFrame

Updated on: March 9, 2023 | 1 Comment

In this lesson, you will learn pandas DataFrame. It covers the basics of DataFrame, its attributes, functions, and how to use DataFrame for Data Analysis.

DataFrame is the most widely used data structure in Python pandas. You can imagine it as a table in a database or a spreadsheet.

Imagine you have an automobile showroom, and you want to analyze cars’ data to make business strategies. For example, you need to check how many vehicles you have in your showroom of type sedan, or the cars that give good mileage. For such analysis pandas DataFrame is used.

Table of contents

  • What is DataFrame in Pandas
  • DataFrame creation
    • DataFrame constructor
    • Dataframe from dict
    • Dataframe from CSV
  • DataFrame Options
    • To customize the display of DataFrame while printing
  • DataFrame metadata
    • Metadata info of DataFrame
    • Get the statistics of DataFrame
  • DataFrame Attributes
    • Example
  • DataFrame selection
    • Example
  • DataFrame modification
    • Insert columns
    • Drop columns
    • Apply condition
  • DataFrame filter columns
  • DataFrame rename columns
  • DataFrame Join
  • DataFrame GroupBy
  • DataFrame Iteration
  • DataFrame Sorting
  • DataFrame conversion
  • Next Steps

What is DataFrame in Pandas

Dataframe is a tabular(rows, columns) representation of data. It is a two-dimensional data structure with potentially heterogeneous data.

Dataframe is a size-mutable structure that means data can be added or deleted from it, unlike data series, which does not allow operations that change its size.