Skip to content

Commit

Permalink
Rename printschema() to print_schema().
Browse files Browse the repository at this point in the history
  • Loading branch information
isabekov committed Mar 29, 2024
1 parent ca505a3 commit 67787d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pyspark_cookbook.org
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
sys.stdout = self._stdout
#+end_src

#+name: printschema
#+name: print_schema
#+begin_src python :var df="df" :exports none :results value raw :session none
return f'''
<<captureoutput>>
Expand Down Expand Up @@ -1050,7 +1050,7 @@ Filter: ~F.col("Product").isin(["Laptop", "Mouse"])~
return Counter(x).most_common(1)[0][0]

dft = df.withColumn("mode", udf_mode("A"))
<<printschema("dft")>>dft.printSchema()
<<print_schema("dft")>>dft.printSchema()
dft.show()
#+END_SRC

Expand Down Expand Up @@ -1092,7 +1092,7 @@ root

df = df.withColumn("diff", diff_of_two_consecutive_elements(F.col("values")))
df.show()
<<printschema("df")>>df.printSchema()
<<print_schema("df")>>df.printSchema()
#+END_SRC

#+RESULTS:
Expand Down Expand Up @@ -1979,7 +1979,7 @@ Full join on ~df_a['value'] == df_b['updated']~ with dropped ~df_b['id']~ column
)
print("Dataframe with key -> value mapping")
dft.show(truncate=False)
<<printschema("dft")>>dft.printSchema()
<<print_schema("dft")>>dft.printSchema()
#+END_SRC

#+RESULTS:
Expand Down Expand Up @@ -2037,7 +2037,7 @@ root
.withColumn('key_value', map_array('key_value')))
print("Dataframe with keys and values:")
dft.show(truncate=False)
<<printschema("dft")>>dft.printSchema()
<<print_schema("dft")>>dft.printSchema()
#+END_SRC

#+RESULTS:
Expand Down

0 comments on commit 67787d1

Please sign in to comment.