From 04caabe01b99ba9337e158c9c1018335eed35bcc Mon Sep 17 00:00:00 2001 From: HimakarC <116370824+HimakarC@users.noreply.github.com> Date: Fri, 17 May 2024 17:06:47 +0530 Subject: [PATCH 01/11] Update index.md --- contrib/pandas/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/pandas/index.md b/contrib/pandas/index.md index 5c0f2b4..aadd970 100644 --- a/contrib/pandas/index.md +++ b/contrib/pandas/index.md @@ -1,3 +1,4 @@ # List of sections - [Pandas Series Vs NumPy ndarray](pandas_series_vs_numpy_ndarray.md) +- [Excel Operations using Pandas DataFrame](excel_with_pandas.md) From 4ffc87b269773a98dfc5824abb32117684b85211 Mon Sep 17 00:00:00 2001 From: HimakarC <116370824+HimakarC@users.noreply.github.com> Date: Fri, 17 May 2024 17:07:17 +0530 Subject: [PATCH 02/11] Create excel_with_pandas.md --- contrib/pandas/excel_with_pandas.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 contrib/pandas/excel_with_pandas.md diff --git a/contrib/pandas/excel_with_pandas.md b/contrib/pandas/excel_with_pandas.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/contrib/pandas/excel_with_pandas.md @@ -0,0 +1 @@ + From 56170159e1ca6e88cfcee929e3316c7dac4432da Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 May 2024 18:09:43 +0530 Subject: [PATCH 03/11] written --- contrib/pandas/excel_with_pandas.md | 50 +++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/contrib/pandas/excel_with_pandas.md b/contrib/pandas/excel_with_pandas.md index 8b13789..6902c3f 100644 --- a/contrib/pandas/excel_with_pandas.md +++ b/contrib/pandas/excel_with_pandas.md @@ -1 +1,51 @@ +# Pandas DataFrame + +The Pandas DataFrame is a two-dimensional, size-mutable, and possibly heterogeneous tabular data format with labelled axes. A data frame is a two-dimensional data structure in which the data can be organised in rows and columns. Pandas DataFrames are comprised of three main components: data, rows, and columns. + +In the real world, Pandas DataFrames are formed by importing datasets from existing storage, which can be a Excel file, a SQL database or CSV file. Pandas DataFrames may be constructed from lists, dictionaries, or lists of dictionaries, etc. + + +### Installation of libraries + +`pip install pandas + pip install xlrd` + + +Example for reading data from an Excel File: + +```python +import pandas as pd + +l = pd.read_excel('example.xlsx') +d = pd.DataFrame(l) +print(d) +``` +Output: +'''python + Name Age +0 John 12 +''' + +- **Note:** The above program can also be used for loading/retrieving the data. + + +Example for Inserting Data into Excel File: + +```python +import pandas as pd + +l = pd.read_excel('file_name.xlsx') +d = {'Name': ['Bob', 'John'], 'Age': [12, 28]} +d = pd.DataFrame(d) +L = pd.concat([l, d], ignore_index = True) +L.to_excel('file_name.xlsx', index = False) +print(L) +``` + +Output: +'''python + Name Age +0 Bob 12 +1 John 28 +''' From 9eb63b951d03e283aa76ee0d9ce980dc4ea509ee Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 May 2024 18:11:53 +0530 Subject: [PATCH 04/11] updated --- contrib/pandas/excel_with_pandas.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/pandas/excel_with_pandas.md b/contrib/pandas/excel_with_pandas.md index 6902c3f..4e67964 100644 --- a/contrib/pandas/excel_with_pandas.md +++ b/contrib/pandas/excel_with_pandas.md @@ -21,10 +21,10 @@ d = pd.DataFrame(l) print(d) ``` Output: -'''python +```python Name Age 0 John 12 -''' +``` - **Note:** The above program can also be used for loading/retrieving the data. @@ -43,9 +43,9 @@ print(L) ``` Output: -'''python +```python Name Age 0 Bob 12 1 John 28 -''' +``` From 0b6bd74a3b7daae3b28f8fc66576d23baee4bbc0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 May 2024 18:12:42 +0530 Subject: [PATCH 05/11] updated --- contrib/pandas/excel_with_pandas.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pandas/excel_with_pandas.md b/contrib/pandas/excel_with_pandas.md index 4e67964..b09b8c3 100644 --- a/contrib/pandas/excel_with_pandas.md +++ b/contrib/pandas/excel_with_pandas.md @@ -7,7 +7,7 @@ In the real world, Pandas DataFrames are formed by importing datasets from exis ### Installation of libraries -`pip install pandas +`pip install pandas
pip install xlrd` From f8044fb421f609c0ae67e65eefb4feabac914568 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 May 2024 18:13:28 +0530 Subject: [PATCH 06/11] updated --- contrib/pandas/excel_with_pandas.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/pandas/excel_with_pandas.md b/contrib/pandas/excel_with_pandas.md index b09b8c3..af87b7b 100644 --- a/contrib/pandas/excel_with_pandas.md +++ b/contrib/pandas/excel_with_pandas.md @@ -7,8 +7,8 @@ In the real world, Pandas DataFrames are formed by importing datasets from exis ### Installation of libraries -`pip install pandas
- pip install xlrd` +`pip install pandas` +`pip install xlrd` Example for reading data from an Excel File: From 9fe61b8ec04b71037dff7506dd6169f259111bfa Mon Sep 17 00:00:00 2001 From: HimakarC <116370824+HimakarC@users.noreply.github.com> Date: Fri, 17 May 2024 18:15:20 +0530 Subject: [PATCH 07/11] Update excel_with_pandas.md --- contrib/pandas/excel_with_pandas.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pandas/excel_with_pandas.md b/contrib/pandas/excel_with_pandas.md index af87b7b..137ef45 100644 --- a/contrib/pandas/excel_with_pandas.md +++ b/contrib/pandas/excel_with_pandas.md @@ -7,7 +7,7 @@ In the real world, Pandas DataFrames are formed by importing datasets from exis ### Installation of libraries -`pip install pandas` +`pip install pandas`
`pip install xlrd` From e4e9ad812fe87d70862390074deba405c2f9fe13 Mon Sep 17 00:00:00 2001 From: HimakarC <116370824+HimakarC@users.noreply.github.com> Date: Fri, 17 May 2024 18:16:41 +0530 Subject: [PATCH 08/11] excel_with_pandas.md --- contrib/pandas/excel_with_pandas.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/contrib/pandas/excel_with_pandas.md b/contrib/pandas/excel_with_pandas.md index 137ef45..13218d6 100644 --- a/contrib/pandas/excel_with_pandas.md +++ b/contrib/pandas/excel_with_pandas.md @@ -26,8 +26,6 @@ Output: 0 John 12 ``` -- **Note:** The above program can also be used for loading/retrieving the data. - Example for Inserting Data into Excel File: From e830336a54f5f6bce6e597df9900ee35b7a71709 Mon Sep 17 00:00:00 2001 From: HimakarC <116370824+HimakarC@users.noreply.github.com> Date: Fri, 17 May 2024 18:25:40 +0530 Subject: [PATCH 09/11] Create excel_with_pandas.md --- contrib/pandas/excel_with_pandas.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/pandas/excel_with_pandas.md b/contrib/pandas/excel_with_pandas.md index 13218d6..5798444 100644 --- a/contrib/pandas/excel_with_pandas.md +++ b/contrib/pandas/excel_with_pandas.md @@ -5,11 +5,20 @@ The Pandas DataFrame is a two-dimensional, size-mutable, and possibly heterogene In the real world, Pandas DataFrames are formed by importing datasets from existing storage, which can be a Excel file, a SQL database or CSV file. Pandas DataFrames may be constructed from lists, dictionaries, or lists of dictionaries, etc. +Features of Pandas `DataFrame`: + +- **Size mutable**: DataFrames are mutable in size, meaning that new rows and columns can be added or removed as needed. +- **Labeled axes**: DataFrames have labeled axes, which makes it easy to keep track of the data. +- **Arithmetic operations**: DataFrames support arithmetic operations on rows and columns. +- **High performance**: DataFrames are highly performant, making them ideal for working with large datasets. + + ### Installation of libraries `pip install pandas`
`pip install xlrd` +- **Note**: The `xlrd` library is used for Excel operations. Example for reading data from an Excel File: From 7fb2baf809f2cd40c0ccdd406fd75f8cb3e29d1b Mon Sep 17 00:00:00 2001 From: HimakarC <116370824+HimakarC@users.noreply.github.com> Date: Fri, 17 May 2024 18:31:22 +0530 Subject: [PATCH 10/11] Update excel_with_pandas.md --- contrib/pandas/excel_with_pandas.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/pandas/excel_with_pandas.md b/contrib/pandas/excel_with_pandas.md index 5798444..d325e46 100644 --- a/contrib/pandas/excel_with_pandas.md +++ b/contrib/pandas/excel_with_pandas.md @@ -56,3 +56,8 @@ Output: 1 John 28 ``` +### Usage of Pandas DataFrame: + +- Can be used to store and analyze financial data, such as stock prices, trading data, and economic data. +- Can be used to store and analyze sensor data, such as data from temperature sensors, motion sensors, and GPS sensors. +- Can be used to store and analyze log data, such as web server logs, application logs, and system logs From 0ad50df483d3179134a5e3551a661f6473a3500b Mon Sep 17 00:00:00 2001 From: HimakarC <116370824+HimakarC@users.noreply.github.com> Date: Fri, 17 May 2024 19:28:54 +0530 Subject: [PATCH 11/11] Update index.md --- contrib/pandas/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pandas/index.md b/contrib/pandas/index.md index aadd970..834d1f4 100644 --- a/contrib/pandas/index.md +++ b/contrib/pandas/index.md @@ -1,4 +1,4 @@ # List of sections - [Pandas Series Vs NumPy ndarray](pandas_series_vs_numpy_ndarray.md) -- [Excel Operations using Pandas DataFrame](excel_with_pandas.md) +- [Excel using Pandas DataFrame](excel_with_pandas.md)