Skip to content

Commit 9e3cae9

Browse files
authored
Clarifies attribute and method
Added text to better explain attributes and methods.
1 parent 6f47959 commit 9e3cae9

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

_episodes/02-starting-with-data.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,18 @@ We'll talk a bit more about what the different formats mean in a different lesso
321321
There are many ways to summarize and access the data stored in DataFrames,
322322
using attributes and methods provided by the DataFrame object.
323323

324-
To access an attribute, use the DataFrame object name followed by the attribute
325-
name `df_object.attribute`. Using the DataFrame `surveys_df` and attribute
326-
`columns`, an index of all the column names in the DataFrame can be accessed
327-
with `surveys_df.columns`.
328-
329-
Methods are called in a similar fashion using the syntax `df_object.method()`.
330-
As an example, `surveys_df.head()` gets the first few rows in the DataFrame
331-
`surveys_df` using **the `head()` method**. With a method, we can supply extra
332-
information in the parens to control behaviour.
324+
Attributes are features of an object. For example, the `shape` attribute will output
325+
the size (the number of rows and columns) of an object. To access an attribute,
326+
use the DataFrame object name followed by the attribute name `df_object.attribute`.
327+
For example, using the DataFrame `surveys_df` and attribute `columns`, an index
328+
of all the column names in the DataFrame can be accessed with `surveys_df.columns`.
329+
330+
Methods are like functions, but they only work on particular kinds of objects. As
331+
an example, **the `head()` method** works on DataFrames. Methods are called in a
332+
similar fashion to attributes, using the syntax `df_object.method()`. Using
333+
`surveys_df.head()` gets the first few rows in the DataFrame `surveys_df`
334+
using **the `head()` method**. With a method, we can supply extra information
335+
in the parens to control behaviour.
333336

334337
Let's look at the data using these.
335338

0 commit comments

Comments
 (0)