forked from OpenSenseAction/OpenSense_workshop_git_hub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.py
More file actions
25 lines (17 loc) · 707 Bytes
/
functions.py
File metadata and controls
25 lines (17 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# some python functions to used in example_notebook.ipynb
def read_multi_csv(path=""):
import glob
import pandas as pd
all_filenames = [i for i in glob.glob(path+'*.{}'.format('csv'))]
combined_data = pd.concat([pd.read_csv(f,sep=';') for f in all_filenames ])
return combined_data
def barplot_data(data,variable=None):
if (variable is None):
print('please provide a variable name!')
return
data.hist(variable)
def scatter_data(data,variable_1=None,variable_2=None):
if (variable_1 is None) or (variable_2 is None):
print('please provide two variable names!')
return
data.plot.scatter(x=variable_1,y=variable_2)