How to limit number rows to display using display method in Spark databricks notebook ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 01:37 AM
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 01:40 AM
@Ravi Teja you can use limit() function to limit the number of row
You can refer below code -
data_frame.limit(10).display()
Ajay Kumar Pandey
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 02:31 AM
hey @Ravi Teja there is two methods by which we can limit our datafame , by using take and limit .
refer this concept
myDataFrame.take(10)
-> results in an Array of Rows. This is an action and performs collecting the data (like collect does).
myDataFrame.limit(10)
-> results in a new Dataframe. This is a transformation and does not perform collecting the data.
Rishabh Pandey

