MOBI BOOT CAMP CORP. logoLearning Buddy
  • SIGN IN
  • Introduction
  • 1: NumPy Module
  • 2: Pandas Module
    • Series Structure
    • Series Quiz
    • Colab Exercise
    • DataFrame Structure
    • File Reading & Writing
    • Summary Statistics using DataFrames
    • Additional Functions
    • DataFrame Quiz
    • Colab Exercise
  • 3: Pandas - More on Dataframes
  • 4: Matplotlib Module
  • 5: Seaborn Module
  • 6: Plotly Express Module
  • 7: GeoSpatial Modules
  • 8. Other Popular Libs
  • 9. Data Driven Stories
  • 10. Bad Visualization Example
  • 11. Glossary
  • Slides-1
  • Slides-2

To obtain 10 random records from your DataFrame `df`, you would use:

df.sample(10) df.random(10) df.head(10) df.tail(10) `head()` or `tail()` will give you the first 10 or last 10 records, respectively, and are therefore not random. `sample()` will provide 10 records at random. There is no function called `random()`.

Does the `corr()` function, when applied to a DataFrame, derive correlation coefficient values for all numerical columns while ignoring non-numerical columns?

True False Yes, this is true. However, be careful about the numerical values in a column. If a column has zip codes or lat/lon location values, `corr()` will also derive correlations with the numerical values of those columns, which makes no sense in many situations. It may not be a bad idea to hand-pick the columns for which you want to derive correlations.

Exercise

Privacy Policy | Terms & Conditions