Data Analysis on Solar Energy in Spain

Posted on Oct 23, 2020
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

A typical sunny day in Madrid


To meet future demands, fight climate change, decrease reliance on foreign powers, encourage global stability and support the local economy, data shows Spain ought to decrease its dependence on imported fossil fuels and shift focus to take advantage of renewable energy sources available within.


According to Eurostat data from 2018, Spain imports a massive 73% of its energy needs, significantly higher than the average of 56% across all 28 EU member states (27 + United Kingdom, Source: Eurostat). Shockingly, for a country renown for its sunshine with largely mediterranean, subtropical, semiarid and desert climate zones, a paltry 4.64% of its electricity comes from solar sources (2.87% solar photovoltaic and 1.77% solar thermal, Source: Eurostat). Therefore, there are a great deal of opportunities for Spain to expand into the solar energy market.
This lack of dependence on solar energy sources is made obvious in the capital city, Madrid. With a population of 3.2 million, yet contains only 209 buildings that are outfitted with photovoltaic solar panels, of which 61 are city buildings (Source: City of Madrid). This is furthermore an embarrassment for the capital as due to climactic factors as well as its elevation (667 m, 2188 ft), it enjoys some of the longest sunshine duration hours in Europe, averaging 2769 hours of sunshine a year, corresponding to around 300 sunny days a year.
As a study of the potential Madrid has to augment its generation of solar power, data from the 61 municipal buildings that contain rooftop solar panel installations was analyzed as a test set. This allowed for the calculation of photovoltaic kilowatt-hours generated (kWh), which was extrapolated to query how much energy could hypothetically be generated across the city given more widespread installation of photovoltaics.


This data visualization is intended to demonstrate to the general public and interested parties the potential benefits of widespread generation of electricity using solar photovoltaics, generally in sunny regions, such as Spain, and more specifically in Madrid. As a rough calculation, extrapolating the data from the 61 municipal buildings gives the following estimated values: The yearly yield of the photovoltaic buildings test set is ~900000 kWh per year, or an average of 15000 kWh per year per building.Β Extending this for larger implementation to the residential sector, there are ~110000 multi-unit apartment buildings in Madrid, giving a potential to generate 1.65 billion kWh per year. Considering that the energy consumption of the residential sector for 2019 was 4.3 billion kWh, the implementation of photovoltaics in every apartment building in the city could decrease consumption demand from the grid by ~38% per year.


  • Use cadastral data to make more precise predictions regarding the number of potential buildings that could have solar photovoltaic installed (due to roof type, dimensions, construction date, etc.).
  • Present finer monthly analysis of potential solar energy yield and how much that would decrease grid electricity consumption. For example, in summer months sun duration is longer but energy consumption is increased, then how much would the dependence on the grid decrease?
  • Evaluate economic factors, including photovoltaic installation and maintenance costs and current electricity costs in Madrid.
  • Estimate how many tons of carbon dioxide would be prevented from atmospheric release (by month, year) with widespread implementation of photovoltaics.
  • Develop a calculation tool to aid building owners to decide if installation of photovoltaics would be economically feasible.

Check it out here:



About Author

Ryan Kniewel

I have a diverse background in biotechnology and synthetic biology with over 20 years of experience engineering microorganisms using tools from biochemistry, molecular biology, genetics and bioinformatics. I am expanding my knowledge base to address a new range...
View all posts by Ryan Kniewel >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI