Predicting future events

machine_learning
time_series
python

#1

Thank you.


#2

HI @arman, Can you clarify on the problem you’re having?


#3

I tried to make the shape of the 7th column (row[6]) and the other columns the same but it is giving me errors. Could you try to re-run with the data i uploaded my dear? it will be easy for you to spot my errors


#4

If I understand you correctly, you want to extract only the “win” column values for analysis. You are trying to write your own code to do this right?

I suggest you use pandas to do this. I’ll post the code here.

# import module
import pandas as pd

# read data
net_data = pd.read_csv('net_data.csv')

# print first five rows
print net_data.head()

# extract values from column "win"
win_values = net_data.ix[:, 'win']

# print first five values from win_values
win_values.head()

Hope this helps!

PS: Your code has too many errors. Some of them I’ve edited in the code above. For others I could not comprehend them, specially this

Traceback (most recent call last):
File “trial1.py”, line 40, in
get_data(‘net_data.csv’)
File “trial1.py”, line 12, in get_data
csvFileReader.next() # skipping column names
_csv.Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?


#5

Thank you so much my dear. Your code prints the 5 rows in each column. But the problem now is how can I apply a time-seriens analysis on the 7th column. I just want to do a time-series prediction analysis on the 7th column like when it increases and when the value decreases. If you do print(win_values), you get the following values. And as you can see it starts with 10, 11, … and somewhere it goes up and down. That’s what i want to do prediction on.

0 10
1 11
2 20
3 30
4 40
5 60
6 70
7 80
8 81
9 81
10 83
11 85
12 85
13 87
14 89
15 90
16 91
17 93
18 94
19 96
20 98
21 99
22 100
23 103
24 103
25 103
26 105
27 105
28 105
29 105

14945 296
14946 296
14947 296
14948 296
14949 296
14950 296
14951 296
14952 296
14953 296
14954 296
14955 296
14956 296
14957 296
14958 296
14959 296
14960 296
14961 296
14962 296
14963 296
14964 296
14965 296
14966 296
14967 296
14968 296
14969 296
14970 296
14971 296
14972 296
14973 297
14974 297


#6

The object “win_values” is a pandas Series object, and can be easily converted into a python list by doing

win_values.tolist()

PS: If you go through my code, the first print command is just for sanity check, to see if I loaded the file correctly. I then extract the values of win column and store it in win_values, then do a sanity check to see win_values

The printed values you see below is just a representation of the win_values Series object. The first row represents the index and the second row represents actual values.

PPS: Please read more about what Pandas library is and what it can do, I’m sure it will help you. Here are some resources.