Skip to content
Aryan Mishra edited this page Feb 19, 2025 · 5 revisions

Welcome to the Python-Pandas wiki!

What is Pandas?

It is a python library that is used for working with datasets. Pandas has functions for analyzing, cleaning, exploring and manipulating data.

It allows us to analyze big data and make conclusions based on statistical theories.

Pandas can clean messy data sets, and make them readable and relevant.

The source code for Pandas is located at this github repository https://github.com/pandas-dev/pandas

LEARN BASIC CODE OF PANDAS:

First we import pandas in code through: (import pandas as pd) then we create dictionary of our needed dataset, after this we convert the dictionary into pandas "DataFrame".

A DataFrame is essentially a table with rows and columns, where:

--> Each key in the dictionary becomes a column header.

--> Each list becomes the values under the respective columns.

Finally we print our dataframe for output using "print" function.


What is a Series?

A Pandas Series is like a column in a table. It is a one-dimensional array holding data of any type. _Syntax : "pd.series()" _

Labels:

Labels are used to identify and access data in Series and DataFrames. They provide a way to refer to rows and columns using meaningful names or indices, instead of just numerical positions. "With the 'index' argument, you can name your own labels."

DataFrames

Data sets are usually multi-dimensional tables called DataFrames. "Series is a column, a DataFrame is whole table" Pandas use the "loc" attribute to return one or more specified row(s)


Load Files Into a DataFrame

If data sets are stored in a file, Pandas can load them into a DataFrame. Syntax : "pd.read.csv('file_name.csv' )" Full Form Of CSV is "COMMA SEPERATED FILES" NOTE: File should be present in the current directory for the above code to work. If it is in a different directory, you will need to provide the full path to the file.

"Tip: use to_string() to print the entire DataFrame."

max_rows

The number of rows returned is defined in Pandas option settings.

We can check our system's maximum rows with the pd.options.display.max_rows statement.

Reading JSON files

Big data sets are stored as JSON. It is a plain text, but has format of object.

SYNTAX: pd.read_json()

JSON as Python Dictionary

-JSON objects have same format as Python dictionaries. -If your JSON code is not in a file, but in a Python Dictionary, you can load it into a DataFrame directly.

Clone this wiki locally