-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuseful_functions.py
30 lines (25 loc) · 962 Bytes
/
useful_functions.py
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
26
27
28
29
30
#-----------
#
# Import required libraries
#
#-----------
import numpy as np
import pandas as pd
# to generate random numbers
import random
#-----------
#
# Create empty dataframe from scratch and storing it in variable df
#
#-----------
df = pd.DataFrame()
# create a list for each column
name = ['Toni','Joanmi','Biel','Pere','Xisco','Xavi','Miquel','Jordi','Toni']
surname = ['Rigo','Perello','Nadal','Manresa','Adrover','Coves','Caldentey','Bauza','Mestre']
hobby = ['Running', 'Triathlon','Crossfit', 'Bouldering', 'Yoga', 'Running', 'Crossfit', 'Sailing']
city_residence = ['Felanitx', 'Palma', 'Barcelona', 'Barcelona', 'Portocolom', 'Eivissa', 'Felanitx', 'Felanitx']
country_residence = ['Spain', 'Spain', 'Spain', 'Spain', 'Spain', 'Spain', 'Spain', 'Spain']
no_cousins = [13, 13, 11, 12, 12, 14, 15, 11, 4]
# list of column names
columns=['name','surname',hobby,city_residence,country_residence,no_cousins]
df = pd.DataFrame( ,columns = columns)