> For the complete documentation index, see [llms.txt](https://docs.geopard.tech/geopard-tutorials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.geopard.tech/geopard-tutorials/esp/consejos-rapidos-de-sig/qgis-cambiar-valores-de-cadena-a-numero-en-el-shapefile.md).

# QGIS: cambiar valores de cadena a número en el shapefile

Convierte atributos de texto en valores numéricos en QGIS para análisis e importación.

En QGIS, puedes convertir una cadena de texto en un número usando la herramienta "Calculadora de campos". Primero, abre la tabla de atributos de la capa que deseas modificar. Luego, haz clic en el botón "Abrir calculadora de campos". En el cuadro "Expresión", escribe "to\_real(" seguido del nombre del campo que contiene la cadena que quieres convertir, y el paréntesis de cierre. Por ejemplo, para convertir un campo de texto llamado "string\_field" en un campo numérico, introduce "to\_real("string\_field")" en el cuadro Expresión. También puedes modificar el nombre del campo de salida y el tipo de datos seleccionando las opciones adecuadas. Por último, haz clic en "OK" para completar la conversión. El campo de texto original permanecerá en la tabla de atributos, mientras que el nuevo campo numérico se añadirá a la tabla.

<figure><img src="https://2708050521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYICBELdyAXXebKAzfLOR%2Fuploads%2Fi3rxrGu9XbcEMSGWGGEX%2FScreenshot%202023-04-03%20at%2017.22.03.png?alt=media&amp;token=1425fbc0-f7fa-4d0d-b794-b50c8db37b8d" alt=""><figcaption></figcaption></figure>

1. Abrir "Propiedades"
2. Ir a "Calculadora de campos"
3. Marcar "Actualizar campo existente"
4. to\_real("attributeName")
5. Guardar ediciones
6. Repite lo mismo para cada atributo

   <figure><img src="https://2708050521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYICBELdyAXXebKAzfLOR%2Fuploads%2Fc6LPt5wG8QlPkfn1B00s%2FScreenshot%202023-04-03%20at%2017.29.49.png?alt=media&amp;token=86437f74-6d54-4cae-8e04-ff319e4769a6" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.geopard.tech/geopard-tutorials/esp/consejos-rapidos-de-sig/qgis-cambiar-valores-de-cadena-a-numero-en-el-shapefile.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
