Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
ebb858ce
Commit
ebb858ce
authored
Apr 30, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add distinct
parent
a704e2fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
multi.py
tensnsorflow/multi.py
+9
-2
No files found.
tensnsorflow/multi.py
View file @
ebb858ce
...
@@ -6,6 +6,8 @@ import pytispark.pytispark as pti
...
@@ -6,6 +6,8 @@ import pytispark.pytispark as pti
from
pyspark.sql
import
SparkSession
from
pyspark.sql
import
SparkSession
import
datetime
import
datetime
import
pandas
as
pd
import
pandas
as
pd
import
hdfs
import
avro
def
app_list_func
(
x
,
l
):
def
app_list_func
(
x
,
l
):
b
=
x
.
split
(
","
)
b
=
x
.
split
(
","
)
...
@@ -200,7 +202,10 @@ def test():
...
@@ -200,7 +202,10 @@ def test():
df
=
spark
.
createDataFrame
(
spark
.
sql
(
sql
)
.
rdd
.
map
(
lambda
x
:(
x
[
0
],
x
[
1
]))
.
zipWithIndex
()
df
=
spark
.
createDataFrame
(
spark
.
sql
(
sql
)
.
rdd
.
map
(
lambda
x
:(
x
[
0
],
x
[
1
]))
.
zipWithIndex
()
.
map
(
lambda
x
:(
x
[
1
],
x
[
0
][
0
],
x
[
0
][
1
])))
.
toDF
(
"ind"
,
"k"
,
"v"
)
.
map
(
lambda
x
:(
x
[
1
],
x
[
0
][
0
],
x
[
0
][
1
])))
.
toDF
(
"ind"
,
"k"
,
"v"
)
df
.
show
(
6
)
df
.
show
(
6
)
df
.
write
.
csv
(
'/recommend/test'
,
mode
=
'overwrite'
,
header
=
True
)
df
=
df
.
toPandas
()
from
hdfs
import
InsecureClient
client
=
InsecureClient
(
'http://nvwa01:50070'
)
hdfs
.
ext
.
dataframe
.
write_dataframe
(
client
,
"/recommend/tr"
,
df
)
# spark.sql("use online")
# spark.sql("use online")
# spark.sql("ADD JAR /srv/apps/brickhouse-0.7.1-SNAPSHOT.jar")
# spark.sql("ADD JAR /srv/apps/brickhouse-0.7.1-SNAPSHOT.jar")
...
@@ -241,7 +246,9 @@ if __name__ == '__main__':
...
@@ -241,7 +246,9 @@ if __name__ == '__main__':
ti
.
tidbMapDatabase
(
"jerry_test"
)
ti
.
tidbMapDatabase
(
"jerry_test"
)
spark
.
sparkContext
.
setLogLevel
(
"WARN"
)
spark
.
sparkContext
.
setLogLevel
(
"WARN"
)
validate_date
,
value_map
,
app_list_map
,
leve2_map
,
leve3_map
=
feature_engineer
()
#
validate_date, value_map, app_list_map, leve2_map, leve3_map = feature_engineer()
# get_predict(validate_date, value_map, app_list_map, leve2_map, leve3_map)
# get_predict(validate_date, value_map, app_list_map, leve2_map, leve3_map)
test
()
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