1
2**financials_df.head()** displays the first few rows and can immediately flag missing data or anomalies.
3
4**financials_df.tail()** shows you the end of the dataset, often revealing how recent the data is and whether it's been truncated.
5
6![Stock Data](https://financetrain.sgp1.cdn.digitaloceanspaces.com/data-pandas/explore_data_1.png)
7
8### Data Structure
9
10An understanding of your DataFrame's structure is essential before diving into deeper analysis.
11
12We can use **stocks_df.info()** to get a summary of the DataFrame, including the number of non-null entries and data types of each column. This can highlight if certain columns contain missing values that need to be addressed or if data types need conversion.
13
14
Print a concise summary of the DataFrame
print(stocks_df.info())
1
2![Stock Data](https://financetrain.sgp1.cdn.digitaloceanspaces.com/data-pandas/explore_data_2.png)
3
4### Descriptive Statistics
5
6Descriptive statistics provide a high-level summary of the attributes of your dataset
7
8 - **stocks_df.describe()** gives a statistical summary for numerical columns, useful for a quick assessment of distribution and variability.
9 - Custom aggregations like **stocks_df ['** **GOOGL '].mean()** help
10 in understanding specific aspects like the average.
11
12
Get a statistical summary
print(stocks_df.describe())
Find the average price for Google
print(stocks_df['GOOGL'].mean())
1
2![Stock Data](https://financetrain.sgp1.cdn.digitaloceanspaces.com/data-pandas/explore_data_3.png)
3
4### Aggregation
5
6For more specific summary statistics, you can use aggregation methods like mean(), median(), min(), max(), and sum():
7
8
Calculate the average opening price
print(stocks_df['MSFT'].mean())
Find the maximum closing price
print(stocks_df['MSFT'].max())
1The result
2The result will be 61.96290836653386 and 72.52.
3