Visualizing data from a CSV file
- Before you start
- Step 1. Create a connection and a dataset
- Step 2. Create a dataset
- Step 3. Create the first chart
- Step 4. Create the second chart
- Step 5. Create a dashboard
- Step 6. Add charts to the dashboard
- Step 7. Add selectors to the dashboard
- Step 8. Set up widgets and start analyzing dependencies
- Step 9. Continue to analyze the data about superheroes
For our source data, let's use a file named SuperHeroes.csv, which has information about superheroes, like their name, gender, race, and comic book publisher.
In this scenario, you can use DataLens to analyze dependencies, for example:
- A superhero's weight from their gender.
- A superhero's weight from whether they're good or bad.
To visualize and explore your data, set up DataLens follow these steps:
- Before you start.
- Create a connection.
- Create a dataset.
- Create your first chart.
- Create your second chart.
- Create a dashboard.
- Add charts to the dashboard.
- Add selectors to the dashboard.
- Set up widgets and start analyzing dependencies.
- Continue to analyze the data about superheroes.
Before you start
To get started with DataLens:
-
Log in to your Yandex account.
-
Open the DataLens homepage.
-
Click Open Datalens.
-
Select one of the options:
-
If you already have an organization, select it from the drop-down menu in the Organizations tab and click Open DataLens.
Note
To activate a DataLens instance, the user must have the
admin
orowner
role. For more information about roles, see Granting permissions in Organization. -
If you have a cloud but no organization, click Add new DataLens. In the window that opens, enter your organization's name and description and click Create organization and DataLens. For more information about working with organizations, see Getting started with organizations.
-
If you have a technical question about the service, please contact Yandex Cloud support. To ask for advice, discuss the solution to your problem or best practices of the service, write to the DataLens chat in Telegram.
Step 1. Create a connection and a dataset
Create a dataset based on the connection to the CSV file.
-
Go to the interfaceDataLens.
-
Click Create connection.
-
Choose CSV.
-
Click Select CSV file.
-
Select a file. For this example, use SuperHeroes.csv (download link).
Wait until the table content appears on the screen.
-
Click Create.
-
After the data is saved, click Create dataset.
Step 2. Create a dataset
-
Drag the SuperHeroes.csv table from the selection panel to the workspace.
-
Go to the Fields tab.
-
Create a field for the superheros' average weight:
-
Click
-
Choose Duplicate.
-
Rename the Weight (1) duplicate field to Weight avg: click the row name, delete the current name, and enter the new one.
-
In the Aggregation column, select Average for the Weight avg field.
-
-
Click Save in the upper-right corner to save the dataset.
-
Enter a name for the dataset: SuperHeroes dataset, then click Create.
-
When the dataset is saved, click Create chart.
Step 3. Create the first chart
To visualize data by gender, create a chart: column chart.
-
Add the names of superheroes to the chart. To do this, drag the Name field from the Dimensions section to the X section.
-
Add the superheros' weight to the chart. To do this, drag the Weight avg field from the Measures section to the Y section.
-
Sort the chart by weight (for example, in descending order).
-
From the first column in the Measures section, drag the Weight avg field to the Sorting section.
-
-
Leave only the superheroes whose weight is known on the chart (greater than zero).
-
From the first column in the Measures section, drag the Weight avg field to the Filters section.
-
In the window that opens, specify the operation Greater than and the value 0.
-
Click Apply.
-
-
Add a color division for superheroes depending on their gender to the chart. To do this, drag the Gender field from the Dimensions section to the Colors section.
-
Redefine the colors for the Gender dimension.
-
Click the settings icon in the Colors section.
-
Select the colors: Female: pink, Male: blue, unknown: orange.
-
-
Save the chart.
-
Click Save in the upper-right corner to save the chart.
-
In the window that opens, enter a name for the chart: SuperHeroes — gender, then click Save.
-
Step 4. Create the second chart
To visualize whether a superhero is good or bad, create a bar chart.
-
Copy the chart from the previous step.
-
Click the down arrow next to the Save button in the upper-right corner.
-
Click Save as.
-
In the window that opens, enter the name of the new chart: SuperHeroes — alignment.
-
Click Save.
-
-
Add to the chart a color division for superheroes depending on whether they are good or bad. To do this, drag the Alignment field from the Dimensions section to the Colors section.
The previous value of the section (the Gender field) is replaced with Alignment.
-
Redefine the colors for the Alignment dimension.
-
Click the settings icon in the Colors section.
-
Select the colors: good: green, neutral: blue, bad: red, unknown: orange.
-
-
Click Save in the upper-right corner to save the chart.
Step 5. Create a dashboard
Create a Dashboard to add your charts to.
-
Go to the DataLens homepage. To do this, click the words Yandex DataLens in the upper-left corner.
-
Click Create dashboard.
-
Enter the name SuperHeroes dashboard for the dashboard and click Create.
Step 6. Add charts to the dashboard
-
The first time you open the dashboard after saving, it opens in edit mode. If you open it later, click Edit in the upper-right corner.
-
Click Add.
-
Choose Chart.
-
In the window that opens, click Select and choose the SuperHeroes — gender chart.
This automatically fills in the Title field with the name of the selected chart.
-
Click Add.
-
Add another chart. Perform all the steps from the beginning and specify the SuperHeroes — alignment chart in step 5.
Step 7. Add selectors to the dashboard
Add selectors to filter superheroes by race (the Race field) and publisher (the Publisher field).
-
Click Add.
-
Choose Selector.
-
Select the SuperHeroes dataset.
-
Select the Race field.
This automatically fills in Title with the name of the selected field.
-
Click the Show checkbox next to the selector title.
-
Enable the Multiple choice option.
-
Click Add.
-
Add another selector. Perform all the steps from the beginning and specify the Publisher field in step 6.
Step 8. Set up widgets and start analyzing dependencies
-
Drag the selectors to the top of the page next to each other.
-
Stretch the charts across the width of the dashboard.
-
Click Save in the upper-right corner to save the dashboard.
-
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 9. Continue to analyze the data about superheroes
You can create new indicators in the dataset, such as average height (average from the Height field) and the number of superheroes (the number of unique 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?