8000 2024/03/30 - Updating Demo python files · rphadtare/python_by_examples@15f06af · GitHub
[go: up one dir, main page]

Skip to content
< 65F0 script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_gsap_index_js-028cb2a18f5a.js" defer="defer">

Commit 15f06af

Browse files
committed
2024/03/30 - Updating Demo python files
1 parent 57278c8 commit 15f06af

File tree

1 file changed

+10
-1
lines changed
  • advanced
    • < 10000 div class="PRIVATE_VisuallyHidden prc-TreeView-TreeViewVisuallyHidden-4-mPv" aria-hidden="true" id=":RmtddabH1:">
      PythonDemo_05_Pandas_module.py

1 file changed

+10
-1
lines changed

advanced/PythonDemo_05_Pandas_module.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def seriesDemo():
3333

3434

3535
def dataFrameDemo():
36+
"""This functions provides demo on pandas dataframe basics"""
3637
d1 = {
3738
"id": [1, 2, 3],
3839
"name": ["Rohit", "Pooja", "Rajani"]
@@ -67,7 +68,7 @@ def dataFrameDemo():
6768

6869

6970
def dataframe_filter_demo():
70-
"""Dataframe operation"""
71+
"""This functions gives demo about pandas Dataframe to select rows on basis of condition"""
7172

7273
d3 = [random.randint(i, i * 10) for i in range(0, 500)]
7374
d4 = ['A', 'B', 'C', 'D', 'E'] * 100
@@ -94,6 +95,7 @@ def dataframe_filter_demo():
9495

9596

9697
def dataframe_duplicate_demo():
98+
"""This functions gives demo to find duplicates in pandas dataframe and remove them"""
9799
d = {
98100
'id': [1, 2, 3, 4, 5, 1],
99101
'name': ['R', 'O', 'H', 'I', 'T', 'R']
@@ -119,6 +121,7 @@ def dataframe_duplicate_demo():
119121

120122

121123
def null_handling_demo():
124+
"""This functions gives demo to handle null values in pandas dataframe"""
122125
d = {
123126
'id': [1, 2, 3, 4, 5, None, 8],
124127
'name': ['R', 'O', 'H', 'I', 'T', 'C', None]
@@ -140,6 +143,7 @@ def null_handling_demo():
140143

141144

142145
def dataframe_add_rows():
146+
"""This functions gives demo to join two same pandas dataframes i.e. row-wise"""
143147
d = {
144148
'id': [1, 2, 3, 4, 5],
145149
'name': ['R', 'O', 'H', 'I', 'T']
@@ -160,6 +164,7 @@ def dataframe_add_rows():
160164

161165

162166
def dataframe_where_demo():
167+
"""This functions gives demo to use where function with pandas dataframe"""
163168
d = {
164169
'id': [1, 2, 3, 4, 5],
165170
'name': ['R', 'O', 'H', 'I', 'T']
@@ -195,6 +200,7 @@ def dataframe_remove_rows():
195200

196201

197202
def dataframe_join_demo():
203+
"""This functions gives demo to use 'join' function with pandas dataframes"""
198204
emp_data = {
199205
'emp_id': [10, 20, 30, 40, 50, 60],
200206
'emp_name': ["Rohit", "Pooja", "Rajani", "Rushi", "Rutu", "Prithvi"],
@@ -221,6 +227,7 @@ def dataframe_join_demo():
221227

222228

223229
def dataframe_merge_demo():
230+
"""This functions gives demo to use 'merge' function with pandas dataframes"""
224231
emp_data = {
225232
'emp_id': [10, 20, 30, 40, 50, 60],
226233
'emp_name': ["Rohit", "Pooja", "Rajani", "Rushi", "Rutu", "Prithvi"],
@@ -244,6 +251,7 @@ def dataframe_merge_demo():
244251

245252

246253
def datframe_export_file():
254+
"""This functions gives demo to export pandas dataframes to files like csv, json"""
247255
emp_data = {
248256
'emp_id': [10, 20, 30, 40, 50, 60],
249257
'emp_name': ["Rohit", "Pooja", "Rajani", "Rushi", "Rutu", "Prithvi"],
@@ -273,6 +281,7 @@ def datframe_export_file():
273281

274282

275283
def dataframe_read_json_export_to_parquet():
284+
"""This functions gives demo to read files like csv, json and stored result in parquet format"""
276285
json_file_path = os.getcwd() + "/data/employee_details/employee.json"
277286
parquet_file_path = os.getcwd() + "/data/employee_details/parquet/"
278287
df = pd.read_json(json_file_path)

0 commit comments

Comments
 (0)
0