这是代码
from pyspark.sql import SparkSession
from pyspark.sql.types import *
from pyspark.sql.functions import *
from pyspark.sql.window import Window
spark = SparkSession \
.builder \
.appName('test') \
.getOrCreate()
tab_data = spark.sparkContext.parallelize(tab_inp)
##
schema = StructType([StructField('id',IntegerType(),True),
StructField('value1',FloatType(),True),
StructField('value2',IntegerType(),True),
StructField('flag',IntegerType(),True)
])
table = spark.createDataFrame(tab_data,schema)
table.createOrReplaceTempView("table")
dummy_df=table.withColumn('dummy',lit('dummy'))
pre_value=dummy_df.withColumn('pre_value',lag(dummy_df['value2']).over(Window.partitionBy('dummy').orderBy('dummy')))
cmb_value=pre_value.withColumn('next_value',lead(dummy_df['value2']).over(Window.partitionBy('dummy').orderBy('dummy')))
new_column=when(col('value1')>0,cmb_value.pre_value) \
.when(col('value1')<0,cmb_value.next_value)\
.otherwise((cmb_value.pre_value+cmb_value.next_value)/2)
final_table=cmb_value.withColumn('value',new_column)
您可以看到class =“ panel-collapse crash”中没有“ in”,并且面板标题显示“ collapsed”。
这在网站的其他页面上正常工作
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h5 class="panel-title"><a class="accordionTitleBar collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria- controls="collapseOne" target="blank" onclick="return false;">Technical Committee</a>
</h5>
</div>
<div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne" style="height: auto;">
<div class="panel-body">
//text goes here
<div style="clear: both;"> </div>
</div>
</div>
</div>
这些代码完全相同,那么为什么第一个页面加载时不折叠?