Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a4869c

Browse files
committed
dataframe trials
1 parent 5cb3aec commit 9a4869c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

example_pkg/clean.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def listhandlingExample(dataline):
2+
3+
return foo_func()

tests.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# 12.1.2020 something close to functional programming
77
# map, reduce and filter operations
88
# https://stackoverflow.com/questions/31127824/what-are-pythons-equivalent-of-javascripts-reduce-map-and-filter
9+
# for dataframe there is this functionality build in
10+
# DataFrame.apply, DataFrame.applymap
911
# datasets for cleaning exercises: https://makingnoiseandhearingthings.com/2018/04/19/datasets-for-data-cleaning-practice/
1012
# 11.1.2020 utest and related.
1113
# from app.mocking import test_method
@@ -62,5 +64,15 @@ def test_samemodule(self, test_para):
6264
result = funcSameNameSpace()
6365
self.assertEqual(result,"testausta")
6466

67+
def test_playdata(self):
68+
#https://stackoverflow.com/questions/16476924/how-to-iterate-over-rows-in-a-dataframe-in-pandas first version
69+
#
70+
from functools import reduce
71+
import pandas as pd
72+
import numpy as np
73+
df = pd.DataFrame({'c1': [10, 11, 12], 'c2': [100, 110, 120]})
74+
for index, row in df.iterrows():
75+
print(row['c1'], row['c2'])
76+
6577
if __name__ == '__main__':
6678
unittest.main()

0 commit comments

Comments
 (0)