1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [ ]:
In [ ]:
In [17]: import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
# Use double backslashes or a raw string for the file path
excel_file = 'C:\\Users\\bhash\\Downloads\\Solar _Power _Plant _Data(AutoRec
# Alternatively, you can use a raw string:
# excel_file = r'C:\Users\bhash\Downloads\Solar _Power _Plant _Data(AutoReco
df = pd.read_excel(excel_file)
# Set a reasonable figure size
plt.figure(figsize=(10, 6)) # Adjust width and height as needed
# Now you can proceed with your plotting code
# For example:
# sns.lineplot(x='your_x_column', y='your_y_column', data=df)
# plt.title('Your Plot Title')
# plt.xlabel('X-axis Label')
# plt.ylabel('Y-axis Label')
# Show the plot
plt.show()
<Figure size 1000x600 with 0 Axes>
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 1/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [23]: import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
data = "C:\\Users\\bhash\\Downloads\\Solar _Power _Plant _Data(AutoRecovered
df = pd.read_excel(data)
df.shape # to check (elements,variables) in the dataset
df.head(10) # to preview the dataset
df.info() #Summary of the dataset
1 WindSpeed 8760 non null float64
2 Sunshine 8760 non-null int64
3 AirPressure 8760 non-null float64
4 Radiation 8760 non-null float64
5 AirTemperature 8760 non-null float64
6 RelativeAirHumidity 8760 non-null int64
7 SystemProduction 8760 non-null float64
8 Unnamed: 8 0 non-null float64
9 Unnamed: 9 0 non-null float64
10 Unnamed: 10 9 non-null object
11 Unnamed: 11 17 non-null object
12 Unnamed: 12 18 non-null object
13 Unnamed: 13 17 non-null object
14 Unnamed: 14 16 non-null object
15 Unnamed: 15 15 non-null object
16 Unnamed: 16 14 non-null object
17 Unnamed: 17 13 non-null object
18 Unnamed: 18 2 non-null object
dtypes: float64(7), int64(2), object(10)
memory usage: 1.3+ MB
In [ ]: df.shape
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 2/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [31]: df.head(16)
Out[31]:
Date-
WindSpeed Sunshine AirPressure Radiation AirTemperature RelativeAirHum
Hour(NMT)
01.01.2017-
0 0.6 0 1003.8 -7.4 0.1
00:00
01.01.2017-
1 1.7 0 1003.5 -7.4 -0.2
01:00
01.01.2017-
2 0.6 0 1003.4 -6.7 -1.2
02:00
01.01.2017-
3 2.4 0 1003.3 -7.2 -1.3
03:00
01.01.2017-
4 4.0 0 1003.1 -6.3 3.6
04:00
01.01.2017-
5 1.4 0 1003.1 -6.8 1.5
05:00
01.01.2017-
6 1.4 0 1003.7 -7.0 0.4
06:00
01.01.2017-
7 1.3 0 1003.9 -7.0 -0.9
07:00
01.01.2017-
8 0.6 0 1004.3 -6.6 -1.0
08:00
01.01.2017-
9 0.6 0 1004.8 -6.5 -2.0
09:00
01.01.2017-
10 0.4 0 1005.2 -0.8 -1.9
10:00
01.01.2017-
11 1.1 46 1005.8 49.7 -0.2
11:00
01.01.2017-
12 1.2 60 1006.1 138.7 1.8
12:00
01.01.2017-
13 0.4 59 1006.1 121.6 2.7
13:00
01.01.2017-
14 4.0 55 1006.5 77.0 5.0
14:00
01.01.2017-
15 2.7 26 1007.6 33.1 4.8
15:00
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 3/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [28]: df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 8760 entries, 0 to 8759
Data columns (total 19 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Date-Hour(NMT) 8760 non-null object
1 WindSpeed 8760 non-null float64
2 Sunshine 8760 non-null int64
3 AirPressure 8760 non-null float64
4 Radiation 8760 non-null float64
5 AirTemperature 8760 non-null float64
6 RelativeAirHumidity 8760 non-null int64
7 SystemProduction 8760 non-null float64
8 Unnamed: 8 0 non-null float64
9 Unnamed: 9 0 non-null float64
10 Unnamed: 10 9 non-null object
11 Unnamed: 11 17 non-null object
12 Unnamed: 12 18 non-null object
13 Unnamed: 13 17 non-null object
14 Unnamed: 14 16 non-null object
15 Unnamed: 15 15 non-null object
16 Unnamed: 16 14 non-null object
17 Unnamed: 17 13 non-null object
18 Unnamed: 18 2 non-null object
dtypes: float64(7), int64(2), object(10)
memory usage: 1.3+ MB
In [32]: df.describe()
Out[32]:
WindSpeed Sunshine AirPressure Radiation AirTemperature RelativeAirHumidi
count 8760.000000 8760.000000 8760.000000 8760.000000 8760.000000 8760.00000
mean 2.639823 11.180479 1010.361781 97.538493 6.978893 76.71940
std 1.628754 21.171295 12.793971 182.336029 7.604266 19.27899
min 0.000000 0.000000 965.900000 -9.300000 -12.400000 13.00000
25% 1.400000 0.000000 1002.800000 -6.200000 0.500000 64.00000
50% 2.300000 0.000000 1011.000000 -1.400000 6.400000 82.00000
75% 3.600000 7.000000 1018.200000 115.600000 13.400000 93.00000
max 10.900000 60.000000 1047.300000 899.700000 27.100000 100.00000
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 4/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [33]: df.mean()
Out[33]: WindSpeed 2.639823
Sunshine 11.180479
AirPressure 1010.361781
Radiation 97.538493
AirTemperature 6.978893
RelativeAirHumidity 76.719406
SystemProduction 684.746071
Unnamed: 8 NaN
Unnamed: 9 NaN
dtype: float64
In [34]: df.mode()
Out[34]:
Date-
WindSpeed Sunshine AirPressure Radiation AirTemperature RelativeAirH
Hour(NMT)
01.01.2017-
0 1.8 0.0 1011.0 -6.2 -0.7
00:00
01.01.2017-
1 NaN NaN 1012.4 NaN NaN
01:00
01.01.2017-
2 NaN NaN NaN NaN NaN
02:00
01.01.2017-
3 NaN NaN NaN NaN NaN
03:00
01.01.2017-
4 NaN NaN NaN NaN NaN
04:00
... ... ... ... ... ... ...
31.12.2017-
8755 NaN NaN NaN NaN NaN
19:00
31.12.2017-
8756 NaN NaN NaN NaN NaN
20:00
31.12.2017-
8757 NaN NaN NaN NaN NaN
21:00
31.12.2017-
8758 NaN NaN NaN NaN NaN
22:00
31.12.2017-
8759 NaN NaN NaN NaN NaN
23:00
8760 rows × 19 columns
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 5/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [35]: print("Range of Windspeed =", df['WindSpeed'].max() - df['WindSpeed'].min())
print("Range of Sunshine =", df['Sunshine'].max() - df['Sunshine'].min())
print("Range of Air Pressure =", df['AirPressure'].max() - df['AirPressure']
print("Range of Radiation =", df['Radiation'].max() - df['Radiation'].min())
print("Range of Air Temperature =", df['AirTemperature'].max() - df['AirTemp
print("Range of Relative Air Humidity =", df['RelativeAirHumidity'].max() -
print("Range of System Production =", df['SystemProduction'].max() - df['Sys
Range of Windspeed = 10.9
Range of Sunshine = 60
Range of Air Pressure = 81.39999999999998
Range of Radiation = 909.0
Range of Air Temperature = 39.5
Range of Relative Air Humidity = 87
Range of System Production = 7701.0
In [36]: df.var()
Out[36]: WindSpeed 2.652839e+00
Sunshine 4.482237e+02
AirPressure 1.636857e+02
Radiation 3.324643e+04
AirTemperature 5.782486e+01
RelativeAirHumidity 3.716797e+02
SystemProduction 2.212521e+06
Unnamed: 8 NaN
Unnamed: 9 NaN
dtype: float64
In [37]: df.std()
Out[37]: WindSpeed 1.628754
Sunshine 21.171295
AirPressure 12.793971
Radiation 182.336029
AirTemperature 7.604266
RelativeAirHumidity 19.278996
SystemProduction 1487.454665
Unnamed: 8 NaN
Unnamed: 9 NaN
dtype: float64
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 6/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [38]: import pandas as pd
import matplotlib.pyplot as plt
# Assuming 'Date-Hour(NMT)' is your datetime column
df['Date-Hour(NMT)'] = pd.to_datetime(df['Date-Hour(NMT)'])
# Group by month and sum the 'SystemProduction' for each month
monthly_production = df.groupby(df['Date-Hour(NMT)'].dt.strftime('%B'))['Sys
# Plot the bar chart
plt.figure(figsize=(10, 6)) # Adjust the figure size as needed
monthly_production.sort_values().plot(kind='bar', ylabel='Solar power genera
# Show the plot
plt.show()
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 7/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [39]: plt.plot(df["WindSpeed"].sort_values(), df["SystemProduction"])
plt.xlabel('Windspeed')
plt.ylabel('Solar power generation')
Out[39]: Text(0, 0.5, 'Solar power generation')
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 8/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [40]: plt.plot(df["Sunshine"].sort_values(), df["SystemProduction"])
plt.xlabel('Sunshine')
plt.ylabel('Solar power generation')
Out[40]: Text(0, 0.5, 'Solar power generation')
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 9/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [41]: plt.plot(df["AirPressure"].sort_values(), df["SystemProduction"])
plt.xlabel('Air Pressure')
plt.ylabel('Solar power generation')
Out[41]: Text(0, 0.5, 'Solar power generation')
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 10/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [42]: plt.plot(df["Radiation"].sort_values(), df["SystemProduction"])
plt.xlabel('Radiation')
plt.ylabel('Solar power generation')
Out[42]: Text(0, 0.5, 'Solar power generation')
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 11/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [43]: plt.plot(df["AirTemperature"].sort_values(), df["SystemProduction"])
plt.xlabel('Air temperature')
plt.ylabel('Solar power generation')
Out[43]: Text(0, 0.5, 'Solar power generation')
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 12/13
1/22/24, 11:28 PM Untitled36 - Jupyter Notebook
In [44]: plt.plot(df["RelativeAirHumidity"].sort_values(), df["SystemProduction"])
plt.xlabel('Relative air humidity')
plt.ylabel('Solar power generation')
Out[44]: Text(0, 0.5, 'Solar power generation')
localhost:8888/notebooks/Untitled36.ipynb?kernel_name=python3 13/13