Skip to content

Creating, Reading and Writing #175

@oldoc63

Description

@oldoc63
  • Pandas is the most popular Python library for data analysis.
  • To start import pandas as pd
  • There are two core objects in pandas: the DataFrame and the Series.
  • A DataFrame is a table. It contains an array of individual entries, each of which has a certain value. Each entry corresponds to a row (or record) and a column.
pd.DataFrame({'Yes': [50, 21], 'No': [131, 2]})

or

pd.DataFrame({'Bob': ['I liked it.', 'It was awful.'], 'Sue': ['Pretty good.', 'Bland.']})
  • We are using the pd.DataFrame() constructor to generate these DataFrame objects. The syntax for declaring a new one is a dictionary whose keys are the column names (Bob and Sue in this example), and whose values are a list of entries. This is the standard way of constructing a new DataFrame, and the one you are most likely to encounter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions