While reading through the Starting with Data episode, I found the use of df_object to refer to a hypothetical python dataframe and actual dataframe surveys_df rather confusing without more context. Why not reference the hypothetical dataframe as DataFrame.attribute to be consistent with the text description? df_object is not used prior to this in the episode. Only a slight modification, but potentially could trip up newbies.
_To access an attribute, use the DataFrame object name followed by the attribute name df_object.attribute. Using the DataFrame surveys_df and attribute columns, an index of all the column names in the DataFrame can be accessed with surveys_df.columns._
_Methods are called in a similar fashion using the syntax df_object.method(). As an example, surveys_df.head() gets the first few rows in the DataFrame surveys_df using the head() method. With a method, we can supply extra information in the parens to control behaviour._
While reading through the Starting with Data episode, I found the use of
df_object
to refer to a hypothetical python dataframe and actual dataframesurveys_df
rather confusing without more context. Why not reference the hypothetical dataframe asDataFrame.attribute
to be consistent with the text description?df_object
is not used prior to this in the episode. Only a slight modification, but potentially could trip up newbies._To access an attribute, use the DataFrame object name followed by the attribute name
df_object.attribute
. Using the DataFramesurveys_df
and attributecolumns
, an index of all the column names in the DataFrame can be accessed withsurveys_df.columns
.__Methods are called in a similar fashion using the syntax
df_object.method()
. As an example,surveys_df.head()
gets the first few rows in the DataFramesurveys_df
using thehead()
method. With a method, we can supply extra information in the parens to control behaviour._