martes, 3 de diciembre de 2024
lunes, 18 de noviembre de 2024
Google Sheets - script to list all formulas in selected range of current sheet
function getFormulasFromSelectedRange() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getActiveRange(); // Gets the currently selected range
var formulas = range.getFormulas(); // Retrieves the formulas in the selected range
var output = [];
for (var i = 0; i < formulas.length; i++) {
for (var j = 0; j < formulas[i].length; j++) {
if (formulas[i][j]) { // Only add if there's a formula
output.push(
"Cell " + range.getCell(i + 1, j + 1).getA1Notation() + ": " + formulas[i][j]
);
}
}
}
Logger.log(output.join("\n")); // Logs all formulas and their locations
}
martes, 10 de septiembre de 2024
JSON into EXCEL
Explica com convertir un JSON en XLSX
volem analitzar amb EXCEL els projectes del CDTI, accessibles des de l'enllaç:
https://www.cdti.es/datos-abiertos-creditos-subvenciones-y-lineas
Amb el Python
import pandas as pd
import json
# Path to your JSON file
json_file_path = r'C:\Users\1664\proyectos_CDTI\proyectos_CDTI.json'
# Path to save the CSV file
csv_file_path = r'C:\Users\1664\proyectos_CDTI\proyectos_CDTI.csv'
# Load JSON data
with open(json_file_path, 'r', encoding='utf-8') as f:
data = json.load(f)
# Convert JSON to DataFrame
df = pd.DataFrame(data)
# Save DataFrame to CSV
df.to_csv(csv_file_path, index=False, encoding='utf-8')
print(f"CSV file saved to {csv_file_path}")
lunes, 8 de julio de 2024
moodle - border line in a table
<table>
<tbody>
<tr>
<td style="
border: 4px solid red;
background-color: #92a8d1;
padding: 10px;
text-align: right;">sde</td>
<td style="
border: 1px solid blue;
text-align: right;
text-decoration: line-through;">d</td>
<td style="
border: 3px solid orange;
text-align: right;"><s>h</s></td>
</tr>
</tbody>
</table>
domingo, 23 de junio de 2024
avaluació - ponderar RA amb Latex
QMP = \frac{19}{100} \text{Q}_{RA1} + \frac{15}{100} \text{Q}_{RA2} + \frac{15}{100} \text{Q}_{RA3} + \frac{12}{100} \text{Q}_{RA4} + \frac{19}{100} \text{Q}_{RA5} + \frac{12}{100} \text{Q}_{RA6} + \frac{8}{100} \text{Q}_{RA7}
From Latex
viernes, 5 de abril de 2024
Boxplot from data
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Boxplot Example</title>
<!-- Include Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<!-- Your HTML content here -->
<div id="boxplot"></div>
<script>
// Data
const data = [
[1, 1, 2, 7, 7, 5, 10, 3, 6, 8, 3, 4, 1, 7, 7, 4, 1, 5, 8, 6, 1, 2, 8, 4, 4, 6, 8, 6],
[2, 2, 3, 5, 3, 7, 2, 4, 6, 2, 2, 2, 2, 3, 4, 4, 1, 3, 5, 2, 3, 5, 3, 3, 8, 8, 3],
[1, 3, 7, 10, 8, 10, 7, 7, 9, 5, 4, 2, 7, 7, 6, 1, 4, 8, 6, 1, 3, 10, 7, 3, 9, 8, 9],
[1, 4, 7, 8, 8, 6, 9, 9, 2, 6, 7, 8, 1, 6, 6, 1, 6, 7, 1, 3, 7, 1, 8, 7, 6, 7],
[2, 3, 6, 8, 6, 9, 6, 6, 8, 3, 4, 2, 5, 5, 6, 6, 0, 4, 8, 6, 2, 3, 8, 4, 6, 7, 7, 6],
[2, 5, 6, 6, 7, 5, 6, 6, 6, 6, 6, 5, 8, 7, 9, 2, 7, 6, 1, 3, 7, 4, 7, 10, 8, 7],
[3, 4, 7, 6, 10, 5, 7, 8, 4, 5, 5, 7, 6, 6, 1, 5, 6, 2, 3, 8, 5, 5, 8, 6, 6],
[3, 5, 7, 6, 9, 7, 7, 7, 5, 6, 4, 6, 5, 7, 1, 2, 7, 1, 4, 7, 4, 6, 8, 7, 6],
[4, 4, 6, 6, 9, 6, 7, 7, 5, 6, 5, 5, 6, 6, 2, 8, 7, 3, 4, 7, 4, 6, 8, 8, 6],
[5, 5, 8, 5, 9, 6, 9, 8, 4, 4, 4, 5, 6, 5, 7, 7, 4, 5, 9, 6, 6, 9, 7]
];
// Function to draw boxplot
function drawBoxPlot(data) {
const boxplotData = data.map(column => {
return {
y: column,
type: 'box',
};
});
const layout = {
title: 'Boxplot Diagram',
};
Plotly.newPlot('boxplot', boxplotData, layout);
}
// Call the function with data
drawBoxPlot(data);
</script>
</body>
</html>
miércoles, 3 de abril de 2024
append two tables side-by-side
Tenim un grup de dades de tal manera disposades que les files parelles es complementen amb les imparelles. Voldriem una nova taula on cada fila parella sigui seguida de la fila imparella, tot en una única fila en cada cas.
La fórmula al googlesheets és:
=QUERY({FILTER(Sheet1!A:Y, MOD(ROW(Sheet1!A:A), 2) = 1), FILTER(Sheet1!A:Y, MOD(ROW(Sheet1!A:A), 2) = 0)}, "SELECT *")
domingo, 31 de marzo de 2024
sábado, 30 de marzo de 2024
Retrieve plain text from website - from xpath pointer
const element = document.evaluate("//*[@id='__next']//div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
const innerText = element ? element.innerText : "Element not found";
console.log(innerText);
jueves, 28 de marzo de 2024
EXCEL Power Query - keep the file name
= Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Column1", type text}})
lunes, 25 de marzo de 2024
sábado, 23 de marzo de 2024
Representación gràfica de bobinados (Autocad)
(defun c: capdew()
(setq pt1(getpoint "\nEnter first point: ")); Ask the user to select the first point
(setq pt2(getpoint "\nEnter second point: ")); Ask the user to select the second point
; Get the X and Y coordinates of pt1
(setq pt1_x(car pt1))
(setq pt1_y(cadr pt1))
; Get the X and Y coordinates of pt2
(setq pt2_x(car pt2))
(setq pt2_y(cadr pt2))
; Calculate the middle point
(setq mid_pt_x(/ (+ pt1_x pt2_x) 2.0))
(setq mid_pt_y(/ (+ pt1_y pt2_y) 2.0))
; Calculate vertical distance relative to mid_pt_x
(setq vertical_distance(* -0.5(/ (- pt2_x pt1_x) 2.0)))
; Calculate the Y coordinate of the perpendicular point
(setq mid_pt_y_perpendicular(+ mid_pt_y vertical_distance))
(setq mid_pt(list mid_pt_x mid_pt_y)); Create a list for the middle point
(setq perpendicular_pt(list mid_pt_x mid_pt_y_perpendicular)) ; Create a list for the perpendicular point
(setq extended_line_end(list pt2_x mid_pt_y_perpendicular)) ; Create a list for the end point of the extended line
(command "line" pt1 perpendicular_pt pt2); Draw the lines
)
(defun c: capdev()
(setq pt1(getpoint "\nEnter first point: ")); Ask the user to select the first point
(setq pt2(getpoint "\nEnter second point: ")); Ask the user to select the second point
; Get the X and Y coordinates of pt1
(setq pt1_x(car pt1))
(setq pt1_y(cadr pt1))
; Get the X and Y coordinates of pt2
(setq pt2_x(car pt2))
(setq pt2_y(cadr pt2))
; Calculate the middle point
(setq mid_pt_x(/ (+ pt1_x pt2_x) 2.0))
(setq mid_pt_y(/ (+ pt1_y pt2_y) 2.0))
; Calculate vertical distance relative to mid_pt_x
(setq vertical_distance(* 0.5(/ (- pt2_x pt1_x) 2.0)))
; Calculate the Y coordinate of the perpendicular point
(setq mid_pt_y_perpendicular(+ mid_pt_y vertical_distance))
(setq mid_pt(list mid_pt_x mid_pt_y)); Create a list for the middle point
(setq perpendicular_pt(list mid_pt_x mid_pt_y_perpendicular)) ; Create a list for the perpendicular point
(setq extended_line_end(list pt2_x mid_pt_y_perpendicular)) ; Create a list for the end point of the extended line
(command "line" pt1 perpendicular_pt pt2); Draw the lines
(princ(strcat "\nThe middle point coordinates are: "(rtos mid_pt_x) ","(rtos mid_pt_y)))
(princ(strcat "\nThe perpendicular point coordinates are: "(rtos mid_pt_x) ","(rtos mid_pt_y_perpendicular)))
)
lunes, 4 de marzo de 2024
sábado, 17 de febrero de 2024
Chropath: Devuelve todos los parágrafos en que existe el texto "diferencial"
//p[@class="parrafo" and contains(text(), "diferencial")]
miércoles, 14 de febrero de 2024
How To Make A Graph On Google Sheets With Multiple Data Sets & Independent Variables
How To Make A Graph On Google Sheets With Multiple Data Sets & Independent
Variables
miércoles, 7 de febrero de 2024
Inserir salt de pàgina en codi html
First page (this will be on page n.1)
<div style="break-after:page"></div>
Second page (This will be on page n.2)
lunes, 15 de enero de 2024
martes, 9 de enero de 2024
Pgmpy: probabilistic graphical models using Python by A. Ankan, A. Panda
https://conference.scipy.org/proceedings/scipy2015/ankur_ankan.html
Suscribirse a:
Entradas (Atom)