Understanding economic redistribution with credit card payments

Jose Javier Ramasco Data Stories


Cities contain neighborhoods that perform economically better than others. But in some cases the differences are extreme, as it happens in Rio the Janeiro where the average income of rich neighborhoods like Copacabana and Ipanema can be up to 100% higher than in the favelas, as stated by the United Nations.

Inequality is a common issue for many cities in Europe as well, but it is frequently difficult to measure and complex to solve. In a recent study, CSIC, IRSTEA and BBVA used data from credit card payments in Barcelona and Madrid to analyze inequality and simulate a possible solution based on the modification of customer habits.

The hypothesis of this study is that inequality can be mitigated if citizens purchased goods in similar stores located in poorer areas of the city. To test this idea, the objective of this study is twofold: to analyze inequality in a city and simulate how it can be mitigated.

Analytical Framework and Data Sources

Every time that a BBVA cardholder pays at a store, there is a record that connects a person to a business. Each record contains information about the location of the store, the origin of the customer, the category of the business, and the time and amount of purchase. The sample for this study includes 150,000 anonymized credit card transactions in 95,000 businesses in Barcelona and Madrid for a period of two years.

These transactions define a network of links which nodes are, on one extreme, the centers of the zip codes of residence of the cardholders, and, on the other, the stores where the payments were made. To change the destination of a minimum number of shopping trips necessary to rebalance the income of the neighborhoods, a rewiring stochastic algorithm was used. This iterative model kept unchanged the money spent in every transaction and the commercial category where it was made (for this purpose stores are classified into 17 different categories), while optimized the trip time, reducing it.


Initial situation diagnosis  demonstrates that income per business can be five times higher between some neighborhoods in Barcelona and in Madrid, for example Sárria compared to El Besós.


The analysis of this graph also demonstrates how people travel around the city for shopping and serves to test what would happen if citizens purchased in different stores. Finding businesses with the same category which are nearer to the customer, the algorithm demonstrated that a reduction of the income inequality of 80 % is feasible just by modifying 5% of all transactions. Furthermore, the results also prove that this change would reduce the travel time by a 25%.

Many factors concur when a person decides where to buy a product. The thrive of the search, the liking for the place, the cost (mainly) and the treatment received from the personnel just to mention a few. Changing the habits of a customer is a complex objective, and this paper could not cover how this can be achieved. However, this study shows that, though very small changes in our mobility patterns and consumption choices, we could have a large impact in the present state of the cities. Similar to bees living in a hive, we have a very partial view of our urban environment, but ICT devices and credit card data can help us tackle global challenges like poverty and inequality.

Author: José Javier Ramasco