Tag: Google

  • 4. How to write a simple SQL Query in Big Query

    #SQL #queries #BigQuery

    Starting from the custom table I created here, click on Query:

    Start writing your query from this pane

    Question: Which are the Top 5 Most Common male Birth Names in Italy in 1999?

    In SQL pane write:

    SELECT

      nome,

      nati

    FROM `nasciteitalia.datinasciteItalia.diffusionenomi`

    WHERE

      anno=1999

    ORDER BY

      nati DESC

    LIMIT

      5

    This query selects from the data table ‘diffusionenomi’ in database ‘datinasciteItalia’ in project ‘nasciteitalia’ the  two columns (‘nome’ and ‘nati’) for the year ‘1999’ and sorts these two columns in descending order limiting the results to 5 items.

    Click RUN to see the results:

    Check with the reference table from Istat:

  • 2. How to create a free Google BigQuery account for SQL knowledge

    To set up a sandbox account:

    1. Visit the BigQuery sandbox documentation page.
    1. Log in to your preferred Google account by selecting the profile icon in the BigQuery menu bar.
    2. Select the Go to BigQuery button on the documentation page.
    3. You’ll be prompted to select your country and read the terms of service agreement.
    4. This will bring you to the SQL Workspace, where you’ll be conducting upcoming activities. By default, BigQuery creates a project for you.

    After you set up your account, the name of the project will be in the banner in your BigQuery console.

  • 1. Data cleaning (sorting and filtering) with Google Sheets

    1. Data cleaning (sorting and filtering) with Google Sheets

    Data cleaning based on a hands-on activity of Google Data Analytics Professional issued by Coursera

    Skills: #datacleaning #filtering #GoogleSheets

    Goal: understand how to improve the performance of students in a public school. Data source: reports and surveys of two public schools (named GP, MS). Information included in data: student grades, background information, study time, participation in extracurricular activities.

    Access to Google sheet file https://docs.google.com/spreadsheets/d/1lekmvxJDglmqUKxSxSk7TiA8Sfurqc9pTyKXIgUvNm4/template/preview?resourcekey=0-O8LBUyc6VTc9sYPH6hdsmw#gid=1019073941 to download and follow step by step

    Click on the top right corner (Use model) to get a working copy

    Rename the spreadsheet

    Before sorting, select all the data

    Sort from menu: Data->Sort Range->Advanced

    Then sort by school and by age

    To obtain

    Potential issue: scrolling through the data, you see that the age range of the students at GP school is 15-22 years, and the age range of the students at MS school is 15-20 years.

    Filtering to add a restraint: the age range should be 15-19 for both schools. Any student outside this age range should be deleted from the dataset: i.e. remove the ages 20, 21, and 22 from the dataset. To apply a filter to the age column, select the age column by clicking the letter at the top of the column.

    From the menu bar, select Data, then Create a filter

    Click on the filter icon (highlighted in yellow) to deselect 20, 21 and 22

    To obtain

    Turn off filter:  Data and Turn off filter

    Filling in missing data

    Student’s reason for choosing a specific school is important to know for this analysis: the reason column should be complete and without blanks. Apply a filter across the entire spreadsheet, clicking on any cell in the sheet. Then, from the menu bar, select Data and Create a filter.

    Click the Filter icon on the reason column (K). Filter this column for blanks by unchecking all the other values (course, home, reputation).

    Replace the missing values with the value, e.g. none_given. To do this while the column is still filtered for blanks, enter none_given in the first empty cell (K38). Then, press Enter. Immagine che contiene testo, schermata, Carattere, numero

Il contenuto generato dall'IA potrebbe non essere corretto.

    Double click the fill handle to fill all the other blank cells with the value none_given.

    Turn off filter

  • Excel, Copilot and Google My Maps for data journalism

    This is what I learned in the webinar “Kickstart your data journalism #1: Excel” by Arena for data journalism with Adriana Homolova/Jonathan Stoneman on 17th March 2025

    Source Excel file downloadable from www.eea.europa.eu

    Question 1: “Who pollutes the most in terms of chemicals?”

    Choose all columns (or the column Q of emissions only), from the menu Data > Filter to see the down arrow, click on this arrow to sort from maximum to minimum value.

    Choose to expand selection in pop-up window

    To obtain

    Question 2: “Who pollutes the most in terms of Mercury?”

    Option 1: apply filter to column (N) of pollutant and search for Mercury

    Or better

    Option 2:

    Choose Text Filters – Contains

    Question 3: “Who polluted the most in terms of Mercury in 2022?”

    Filter by 2022 as below

    And sort column Q of emissions from biggest to lowest value

    Remember to filter for Mercury

    Question 4: Knowing that Italy has these results, we want to exclude it from the list of countries to see which other country has the same issues.

    Filter the first column (country_name) and deselect Italy.

    Question 5: Which country has released the most arsenic into the water?

    Apply Text Filters – Contains Arsenic to column N of pollutant and sort

    Pivot table

    To organize the data more methodically, for example by year and by country, use Pivot Tables.

    After removing all filters, create a Pivot Table in a new Excel sheet from the Insert → PivotTable menu

    Question 6: Which country pollutes the most?

    Drag the field *pollutant* in the Filters pane, the field *country_name* in Rows e the field *emissions* in Values (Sum) of the Pivot table.

    Right click on any value to sort them, e.g. from biggest to lowest

    Question 7: Which country pollutes the most in terms of Arsenic?

    Search the term arsenic in column B of the row pollutant

    Question 8: Which facility pollutes the most in terms of Arsenic?

    Add the field facility_name in the Pivot table rows to see the facility name.

    It is possible to expand or reduce this view for each country.

    Question 9: Which was the trend of Arsenic pollution in the last years?

    Add the column reportingYear to the Pivot table columns

    Rolling the mouse over a value, e.g. over the total for Serbia of 9454,9 it is possible to see the description

    Double click on a value to obtain the details

    Question 10: How to create a map of the top ten facilities involved in arsenic pollution in Serbia?

    Sort the by emissions and copy the first 10 rows in a new Excel file to create a map.

    Create an account and open Google MyMaps, import the Excel file

    Select longitude and latitude

    Then select facility_name

    Then select single styles by eptr_sector_name

    Copilot

    Question 11: Which Polish power plant emitted the most in 2018?

    In data excel file

    Always check the results, e.g. with a Pivot table.

    Filter by country_name (Poland), eptr_sector_name (energy) and reporting Year (2018)

    And right click on any value in the column Sum of emissions to be able to sort

    We obtain the same value as Copilot.