Visualizing data from a CSV file

For our source data, let's use a file named SuperHeroes.csv, which has information about superheroes, like their name, gender, race, and the comic book publisher.

DataLens can be used to analyze dependencies, for example:

  • The superhero's weight from their gender.
  • The superhero's weight from whether they're good or bad.

To visualize the dependencies for analysis, create a connection to the CSV file, create a dataset based on it, and configure a dashboard by adding the appropriate widgets with charts to it.

Step 1. Create a connection and a dataset

Create a dataset based on a connection to the CSV file with information about superheroes or select an existing connection from the list of connections.

  1. Go to DataLens.

  2. Click Create dataset.

    image

  3. Click Create connection.

    image

  4. Choose CSV.

    image

  5. Click Select CSV file.

    image

  6. Select a file. In this example, it's SuperHeroes.csv.

  7. Wait until the table content appears on the screen.

  8. Click Save.

    image

  9. Enter a name for the dataset: SuperHeroes.

  10. Click Create.

    image

  11. Create a field to store the average superhero weight.

    1. Duplicate the Weight field.

    2. Click image in the Weight row.

    3. Choose Duplicate.

      image

    4. Rename the Weight (1) duplicate field to Weight avg: click the row name, delete the current name, and enter the new one.

    5. In the Aggregation column, select Average for the Weight avg field.

      image

  12. Click Save in the upper-right corner to save the dataset.

    image

Step 2. Create the first chart

To visualize data divided by gender, create a bar chart type chart.

  1. Click Create chart in the upper-right corner.

    image

  2. In the in the second column of the window that opens, click Line chart and choose a different chart type: Bar chart.

    image

  3. Add the names of superheroes to the chart. To do this, from the first column in the Dimensions section, drag the Name field to the X-axis in the second column.

  4. Add the superheroes' weight to the chart. To do this, from the first column in the Measures section, drag the Weight avg field to the Y-axis in the second column.

  5. Sort the chart by weight (for example, in descending order).

    1. From the first column in the Measures section, drag the Weight avg field to the Sorting section.
  6. Leave only the superheroes whose weight is greater than zero on the chart.

    1. From the first column in the Measures section, drag the Weight avg field to the Filters section.

    2. In the window that opens, specify Greater and 0.

    3. Click Apply.

      image

  7. Add to the chart a color division for superheroes depending on their gender. To do this, from the first column in the Dimensions section, drag the Gender field to the Color section.

    image

  8. Save the chart.

    1. Click Save in the upper-right corner to save the chart.

      image

    2. In the window that opens, enter the name of the chart: SuperHeroes — gender.

    3. Click Save.

      image

Step 3. Create the second chart

To visualize whether a superhero is good or bad, create a bar chart.

  1. Copy the chart from the previous step.

    1. Click image in the upper-left corner next to the chart name.

    2. Choose Copy.

      image

    3. In the window that opens, enter the name of the new chart: SuperHeroes — alignment.

    4. Click Ready.

      image

  2. Add to the chart a color division for superheroes depending on whether they are good or bad. To do this, from the first column in the Dimensions section, drag the Alignment field to the Color section.

    The previous value of the section (the Gender field) is replaced with Alignment.

    image

  3. Click Save in the upper-right corner to save the chart.

    image

Step 4. Create a dashboard

Create a dashboard that these charts will be added to.

  1. Go to the DataLens homepage. To do this, click the words Yandex DataLens in the upper-left corner.

  2. Click Create dashboard.

    image

  3. Enter the dashboard name: SuperHeroes dashboard.

  4. Click Create.

    image

Step 5. Add charts to the dashboard

Prepare the dashboard for analysis by adding both charts to it.

  1. In the dashboard that opens, click Edit in the upper-right corner.

    image

  2. Click Add.

  3. Choose Chart.

    image

  4. In the window that opens, click Select.

  5. Select the SuperHeroes — gender chart. This automatically fills in the Title field with the name of the selected chart.

  6. Click Add.

    image

  7. Add another chart. Perform all the steps from the beginning and specify the SuperHeroes — alignment chart in step 4.

    image

Step 6. Add selectors to the dashboard

Add selectors to be able to filter superheroes by race (the Race field) and publisher (the Publisher field).

  1. Click Add.

  2. Choose Selector.

    image

  3. Under the word Dataset, click Select.

  4. Select the SuperHeroes dataset.

  5. Under the word Field, click Select.

  6. Select the Race field. This will automatically fill in the Title field with the name of the selected field.

  7. Enable the Multiple choice option.

  8. Click Add.

    image

  9. Add another selector. Perform all the steps from the beginning and specify the Publisher field in step 6.

    image

Step 7. Set up widgets and start analyzing dependencies

  1. Drag the selectors to the top of the page next to each other.

  2. Stretch the charts across the width of the dashboard.

  3. Click Save in the upper-right corner to save the dashboard.

    image

  4. Apply various filters and analyze the weight dependencies on a superhero's gender and good or bad alignment.

    The dataset analyzed shows the following dependencies:

    • Men are generally heavier than women.
    • Bad superheroes are mostly heavier than good ones.

Step 8. Continue to analyze the data about superheroes

You can create new measures in the dataset, such as average height (average from the Height field) and the number of superheroes (number of unique entries from the Name field) and answer the following questions:

  • Representatives of which race are the most numerous?
  • Does a superhero's height depend on whether they are good or bad?
  • Which studio created the most superheroes?