<jupyter_start><jupyter_text>Version of matplotlib<jupyter_code>import matplotlib
import pandas as pd

import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>US Oil and Gas Production June 2008 to June 2018https://www.kaggle.com/djzurawski/us-oil-and-gas-production-june-2008-to-june-2018* Month - Defines the date of crudeoil production (First day of the month)* U.S. Crude Oil - Total amount of production each month for 10 years(2008-2018)* Other columns are the cities which has the crude oil production<jupyter_code>crude_oil_data = pd.read_csv('datasets/crude_oil_data_processed.csv')

crude_oil_data.head(5)
crude_oil_data['Date'] = pd.to_datetime(crude_oil_data['Date'])

crude_oil_data['Date'].head()<jupyter_output><empty_output><jupyter_text>Line plot* Plotting crude oil according to the date, From here we will be able to understand which day has the highest production, and which date has the lowest production* Is there any reason for the highest and lowest production<jupyter_code>crude_oil_data.plot(x='Date', y='U.S. Crude Oil ', 
                    figsize=(12, 8), color='brown')

plt.ylabel('Production')
plt.title('U.S Crude Oil Production')<jupyter_output><empty_output><jupyter_text>Boxplot* Plotting total crude oil production and its variation, So from this data we are able to understand    * Max - It is in the range 10000-11000    * Min - It is 4000    * Median(50%) - It is in the range 7000-7500    * 25% - It is in the range 5500-6000    * 75% - It is in the range 9000-9500<jupyter_code>crude_oil_data.boxplot('U.S. Crude Oil ', figsize=(12, 8))

plt.ylabel('Production')
plt.title('U.S Crude Oil Production')
crude_oil_data[['California']].boxplot(figsize=(12, 8))

plt.ylabel('Production in California')
plt.title('California Crude Oil Production')
crude_oil_data[['Alaska', 'California']].boxplot(figsize=(12, 8))

plt.ylabel('Production in Alaska, California')
plt.title('Alaska, California Crude Oil Production')<jupyter_output><empty_output><jupyter_text>* Extracting year from the date data, and making a new column. From here we will able to check it out every year production<jupyter_code>crude_oil_data.boxplot(column=['U.S. Crude Oil '], by=['Year'], 
                       figsize=(12, 8))

plt.ylabel('Production')<jupyter_output><empty_output><jupyter_text>* Adding all the values of the `U.S. Crude Oil` column according to the year which we have added just now* From the below data we will be able to understand for the year `2015` has highest production and the year 2008 has less production<jupyter_code>year_data = crude_oil_data.groupby('Year', as_index=False).sum()

year_data[['Year', 'U.S. Crude Oil ']]
colors = ['C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9']

year_data.plot.bar(x='Year', y='U.S. Crude Oil ', 
                   figsize=(12, 8), color=colors, 
                   legend=False)

plt.ylabel('Production')
plt.title('U.S Crude Oil Production')
mean_prod_data = crude_oil_data.mean().sort_values(ascending=False)

mean_prod_data
mean_prod_data[1:]
mean_prod_df = pd.DataFrame(mean_prod_data[1:]).reset_index()

mean_prod_df.columns = ['State', 'Production']

mean_prod_df.head(10)
plt.figure(figsize=(12, 8))

plt.bar(mean_prod_df['State'], mean_prod_df['Production'], 
        width=0.85)

plt.title('US Oil Mean-Production June 2008 to June 2018')

plt.xticks(rotation=90)
plt.xlabel('State')
plt.ylabel('Production')

plt.show()
mean_prod_df['Production'].plot.kde(figsize=(12, 8))

plt.title('US Oil Production June 2008 to June 2018')
plt.xlabel('Oil Production')

plt.show()
colors = ['C0', 'C1', 'C2', 'C3', 'C4']

plt.figure(figsize=(12, 8))

plt.xticks(rotation=70)

plt.bar(mean_prod_df[0:5]['State'], mean_prod_df[0:5]['Production'], 
        width=0.85, color=colors)

plt.hlines(mean_prod_data[0], 0, 4)

plt.title('US Oil Production June 2008 to June 2018')
plt.xlabel('States')
plt.ylabel('Production')

plt.show()
plt.figure(figsize=(12, 8))

plt.scatter(crude_oil_data['Texas'], crude_oil_data['U.S. Crude Oil '], c='g')

plt.xlabel('US Production')
plt.ylabel('Texas Production')

plt.show()
plt.figure(figsize=(12, 8))

plt.scatter(crude_oil_data['California'], crude_oil_data['U.S. Crude Oil '], c='y')

plt.xlabel('US Production')
plt.ylabel('California Production')

plt.show()
plt.figure(figsize=(12, 8))

plt.scatter(crude_oil_data['Michigan'], crude_oil_data['U.S. Crude Oil '], c='g')

plt.xlabel('US Production')
plt.ylabel('Michigan Production')

plt.show()
crude_oil_data['U.S. Crude Oil '].plot.kde(figsize=(12, 8))

plt.title('U.S. Production Density Curve')

plt.show()
crude_oil_data['Texas'].plot.kde(figsize=(12, 8))

plt.title('Texas Production Density Curve')

plt.show()
crude_oil_data['Michigan'].plot.kde(figsize=(12, 8))

plt.title('Michigan Production Density Curve')

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1484149855907781, 'fraction_numerical': 0.03787566899958831, 'mean_word_length': 5.522147651006711, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '273540', 'license': 'MIT', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1719, 'n_words': 420, 'path': 'finding-relationships-data-python/02/demos/demo-02-ExploringAndVisualizingRelationships.ipynb', 'repo_name': 'brockryan2/Jupyter-practice', 'size': '4858'}