Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
R
robo-dividend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenwen.tang
robo-dividend
Commits
5bd442b0
Commit
5bd442b0
authored
Feb 02, 2024
by
wenwen.tang
😕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
699b2532
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
data_access.py
ai/data_access.py
+1
-1
training_data_builder.py
ai/training_data_builder.py
+6
-4
No files found.
ai/data_access.py
View file @
5bd442b0
...
@@ -31,7 +31,6 @@ class DataAccess(ABC):
...
@@ -31,7 +31,6 @@ class DataAccess(ABC):
indexData
.
loc
[
indexData
[
'rid_index_id'
]
==
77
,
'rid_index_id'
]
=
106
indexData
.
loc
[
indexData
[
'rid_index_id'
]
==
77
,
'rid_index_id'
]
=
106
indexData
.
rename
(
columns
=
{
"rid_date"
:
'date'
},
inplace
=
True
)
# please use 'date'
indexData
.
rename
(
columns
=
{
"rid_date"
:
'date'
},
inplace
=
True
)
# please use 'date'
indexData
[
"rid_index_id"
]
=
indexData
[
"rid_index_id"
]
.
map
(
self
.
_indexDict
)
indexData
[
"rid_index_id"
]
=
indexData
[
"rid_index_id"
]
.
map
(
self
.
_indexDict
)
indexData
.
fillna
(
method
=
'ffill'
,
inplace
=
True
)
return
indexData
return
indexData
def
get_eco_datas
(
self
):
def
get_eco_datas
(
self
):
...
@@ -63,6 +62,7 @@ class DataAccess(ABC):
...
@@ -63,6 +62,7 @@ class DataAccess(ABC):
inplace
=
True
)
inplace
=
True
)
vixData
.
set_index
(
'date'
,
inplace
=
True
)
vixData
.
set_index
(
'date'
,
inplace
=
True
)
vixData
.
index
=
pd
.
to_datetime
(
vixData
.
index
)
vixData
.
index
=
pd
.
to_datetime
(
vixData
.
index
)
vixData
.
dropna
(
axis
=
1
,
inplace
=
True
)
return
vixData
return
vixData
def
get_other_index
(
self
,
indexData
):
def
get_other_index
(
self
,
indexData
):
...
...
ai/training_data_builder.py
View file @
5bd442b0
...
@@ -147,6 +147,11 @@ class TrainingDataBuilder(ABC):
...
@@ -147,6 +147,11 @@ class TrainingDataBuilder(ABC):
DataAll
[
col
]
.
bfill
(
inplace
=
True
)
DataAll
[
col
]
.
bfill
(
inplace
=
True
)
DataAll
[
col
]
.
ffill
(
inplace
=
True
)
DataAll
[
col
]
.
ffill
(
inplace
=
True
)
###### clean NaN
DataAll
.
ffill
(
inplace
=
True
)
DataAll
.
dropna
(
inplace
=
True
)
DataAll
.
reset_index
(
inplace
=
True
,
drop
=
True
)
if
(
self
.
_toForecast
):
if
(
self
.
_toForecast
):
# 处理CPI_YOY:美国城镇消费物价指数同比未经季 CPURNSA:美国消费者物价指数未经季调
# 处理CPI_YOY:美国城镇消费物价指数同比未经季 CPURNSA:美国消费者物价指数未经季调
DataAllCopy
=
DataAll
.
copy
()
DataAllCopy
=
DataAll
.
copy
()
...
@@ -157,13 +162,10 @@ class TrainingDataBuilder(ABC):
...
@@ -157,13 +162,10 @@ class TrainingDataBuilder(ABC):
DataAllCopy
.
drop
([
'futureR'
,
'yLabel'
],
axis
=
1
,
inplace
=
True
)
DataAllCopy
.
drop
([
'futureR'
,
'yLabel'
],
axis
=
1
,
inplace
=
True
)
forecastDayIndex
=
DataAllCopy
.
index
[
DataAllCopy
[
'date'
]
==
forecastDay
]
forecastDayIndex
=
DataAllCopy
.
index
[
DataAllCopy
[
'date'
]
==
forecastDay
]
forecastData
=
DataAllCopy
.
iloc
[
forecastDayIndex
.
to_list
(),
1
:]
forecastData
=
DataAllCopy
.
iloc
[
forecastDayIndex
.
to_list
(),
1
:]
forecastData
.
dropna
(
inplace
=
True
,
axis
=
1
)
X_forecast
=
forecastData
.
to_numpy
()
X_forecast
=
forecastData
.
to_numpy
()
del
DataAllCopy
del
DataAllCopy
###### clean NaN
DataAll
.
dropna
(
inplace
=
True
)
DataAll
.
reset_index
(
inplace
=
True
,
drop
=
True
)
###### get X and y
###### get X and y
y
=
DataAll
[
'yLabel'
]
.
to_numpy
(
copy
=
True
)
y
=
DataAll
[
'yLabel'
]
.
to_numpy
(
copy
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment