После поиска я обнаружил, что если я хочу выполнить несколько строк для sqlContext, мне нужно использовать тройной """ вот так:
Код: Выделить всё
sqlContext.sql("""select year,month,count(distinct station) as count
from tempReadingsTable
where year>=1950 and year=10
group by year,month
order by count desc
""").show()
Код: Выделить всё
schMax = schMax.groupBy('year').
agg(fun.max('value').alias('value')).
join(sch['year','value']).
drop_duplicates(['year']).
select(['year','station','value']).
orderBy(['value'],ascending=[0])
Подробнее здесь: https://stackoverflow.com/questions/579 ... r-notebook
Мобильная версия