folks, I am working on one dataset using pandas I have already found my data according to my need but I am unable to plot it accurately month-wise as my result data is shown in any order and in graph floating using matplotlib library is must be in Jan, Feb, March... order AS shown in the picture I need this data in order like Jan, Feb, March...
enter code here
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pandas as pd
df = pd.read_csv('F:/Downloads/DataSet/starlink_launches.csv',
encoding='cp1252')
# CREATE MONTHS AND YEAR COLUMNS
df['launch_Month'] = df['launch_date'].str.split(' ').str[1]
df['launch_Year'] = df['launch_date'].str.split(' ').str[2]
# REPLACE DATA FOR EASY ACCESS
df['launch_outcome'] = df['launch_outcome'].str.replace('Success\r\n',
'Success')
# CREATE DATAFRAME TO STORE RESULTS
result = pd.DataFrame()
result = df[df['launch_outcome'] == 'Success'].groupby('launch_Month'
).count()
# DATA VISULIZATION[![enter image description here][1]][1]
import matplotlib.pyplot as plt
import numpy as np
# plt.figure(figsize=(5,5))
Months = range(1, 13)
plt.bar(Months, result['launch_outcome'])
plt.title('Succes ratio of lunch')
plt.ylabel('Number Of launch', fontsize=12)
plt.xlabel('Months', fontsize=12)
plt.xticks(np.arange(1, 13))
plt.grid()
plt.show()