← Search

Data · dataset · 2024

Histograms for ONGC - open, low, high and adjusted close

Listed in Teesside University Research Data Repository

The provided code performs data analysis and visualization on historical stock price data for the Oil and Natural Gas Corporation (ONGC) from a CSV file.

Description

The code utilizes the pandas library for data manipulation and matplotlib.pyplot for generating histograms to visualize the distribution of various price metrics. Loading Data: The code begins by importing the pandas library as pd and the matplotlib.pyplot library as plt.

The file path of the CSV file containing the ONGC stock price data is specified. The data is loaded into a DataFrame named df using the read_csv() function from pandas. Extracting Required Columns: The code extracts the required columns from the DataFrame, including 'Open', 'High', 'Low', 'Close', and 'Adj Close' prices, and assigns them to separate variables.

Read the rest (4 more)

Summary

Statistics: Summary statistics are computed for each extracted column using the describe() function, which provides metrics such as count, mean, standard deviation, minimum, 25th percentile, median, 75th percentile, and maximum values. Plotting Histograms: Histograms are created for each price metric ('Open', 'High', 'Low', 'Close', 'Adj Close') using the plt.hist() function. Each histogram is plotted in a separate subplot within a single figure using the plt.subplot() function.

The number of bins for each histogram is set to 20 to visualize the distribution of prices across different ranges. Titles and labels are added to each subplot to provide context to the plotted data. Displaying Plots: The plt.tight_layout() function adjusts the spacing between subplots to prevent overlapping.

Finally, the plt.show() function is called to display the histograms. Overall, the code efficiently analyzes the distribution of ONGC stock prices across different metrics and visualizes them using histograms, allowing for easy interpretation of the data's characteristics and patterns.

Links

Where it is published

Catalogue records · 1

Topics

Provenance · 1 source records, 7 field assertions
SourceKeyLast seenRaw
Teesside University Research Data Repositoryoai:data.mendeley.com/nr7whvc92c.115 h agoJSON v1
FieldAssertionExtractorEvidence
access_levelsource · researchdata tees ac ukconnector:researchdata_tees_ac_uk@1.0.0
concepts[field].local:field:earth-environmentalmapping · researchdata tees ac ukconnector:researchdata_tees_ac_uk@1.0.0
concepts[field].local:field:humanitiesmapping · researchdata tees ac ukconnector:researchdata_tees_ac_uk@1.0.0
descriptionsource · researchdata tees ac ukconnector:researchdata_tees_ac_uk@1.0.0/metadata/dc/description
licensesource · researchdata tees ac ukconnector:researchdata_tees_ac_uk@1.0.0/metadata/dc/rights
publication_datesource · researchdata tees ac ukconnector:researchdata_tees_ac_uk@1.0.0
titlesource · researchdata tees ac ukconnector:researchdata_tees_ac_uk@1.0.0/metadata/dc/title