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
60bb07ae
Commit
60bb07ae
authored
Oct 08, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change
parent
67921e0f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
meigou.py
local/meigou.py
+9
-3
No files found.
local/meigou.py
View file @
60bb07ae
...
@@ -55,7 +55,7 @@ def all_click(x):
...
@@ -55,7 +55,7 @@ def all_click(x):
sum
=
sum
+
tmp
sum
=
sum
+
tmp
total
.
append
(
sum
)
total
.
append
(
sum
)
return
tuple
(
total
)
return
sum
def
cpc_click
(
x
):
def
cpc_click
(
x
):
...
@@ -111,7 +111,7 @@ def cpc_click(x):
...
@@ -111,7 +111,7 @@ def cpc_click(x):
cpc
.
append
(
sum
)
cpc
.
append
(
sum
)
return
tuple
(
cpc
)
return
sum
...
@@ -127,14 +127,20 @@ if __name__ == '__main__':
...
@@ -127,14 +127,20 @@ if __name__ == '__main__':
spark
=
SparkSession
.
builder
.
config
(
conf
=
sparkConf
)
.
enableHiveSupport
()
.
getOrCreate
()
spark
=
SparkSession
.
builder
.
config
(
conf
=
sparkConf
)
.
enableHiveSupport
()
.
getOrCreate
()
clicks
=
[]
clicks
=
[]
cpcs
=
[]
cpcs
=
[]
for
i
in
range
(
1
,
26
):
dates
=
[]
for
i
in
range
(
1
,
3
):
clicks
.
append
(
all_click
(
i
))
clicks
.
append
(
all_click
(
i
))
cpcs
.
append
(
cpc_click
(
i
))
cpcs
.
append
(
cpc_click
(
i
))
date_str
=
(
datetime
.
date
.
today
()
-
datetime
.
timedelta
(
days
=
i
))
.
strftime
(
"
%
Y
%
m
%
d"
)
dates
.
append
(
date_str
)
print
(
"clicks"
)
print
(
"clicks"
)
print
(
clicks
)
print
(
clicks
)
print
(
"cpcs"
)
print
(
"cpcs"
)
print
(
cpcs
)
print
(
cpcs
)
df
=
pd
.
DataFrame
({
'date'
:
dates
,
'clicks'
:
clicks
,
"cpc"
:
cpcs
})
df
.
to_csv
(
'/home/gmuser/cpc.csv'
,
index
=
False
)
# rdd = spark.sparkContext.parallelize(cpcs)
# rdd = spark.sparkContext.parallelize(cpcs)
# df = spark.createDataFrame(rdd).toDF.toPandas()
# df = spark.createDataFrame(rdd).toDF.toPandas()
# df.to_csv('/home/gmuser/cpc.csv',index=False)
# df.to_csv('/home/gmuser/cpc.csv',index=False)
...
...
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