-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
554 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[codestyle] | ||
indentation = True | ||
edge_line = True | ||
edge_line_columns = 79 | ||
|
||
[main] | ||
version = 0.2.0 | ||
|
5 changes: 5 additions & 0 deletions
5
Test_Back_end_Pythonk/.spyproject/config/defaults/defaults-codestyle-0.2.0.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[codestyle] | ||
indentation = True | ||
edge_line = True | ||
edge_line_columns = 79 | ||
|
3 changes: 3 additions & 0 deletions
3
Test_Back_end_Pythonk/.spyproject/config/defaults/defaults-encoding-0.2.0.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[encoding] | ||
text_encoding = utf-8 | ||
|
4 changes: 4 additions & 0 deletions
4
Test_Back_end_Pythonk/.spyproject/config/defaults/defaults-vcs-0.2.0.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[vcs] | ||
use_version_control = False | ||
version_control_system = | ||
|
6 changes: 6 additions & 0 deletions
6
Test_Back_end_Pythonk/.spyproject/config/defaults/defaults-workspace-0.2.0.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[workspace] | ||
restore_data_on_startup = True | ||
save_data_on_exit = True | ||
save_history = True | ||
save_non_project_files = False | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[encoding] | ||
text_encoding = utf-8 | ||
|
||
[main] | ||
version = 0.2.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[vcs] | ||
use_version_control = False | ||
version_control_system = | ||
|
||
[main] | ||
version = 0.2.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[workspace] | ||
restore_data_on_startup = True | ||
save_data_on_exit = True | ||
save_history = True | ||
save_non_project_files = False | ||
project_type = 'empty-project-type' | ||
recent_files = [] | ||
|
||
[main] | ||
version = 0.2.0 | ||
recent_files = [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Tue Sep 20 21:18:16 2022 | ||
""" | ||
|
||
|
||
import pandas as pd | ||
import numpy as np | ||
from collections import defaultdict | ||
|
||
|
||
m = pd.read_excel("file.xlsx", header=None).to_numpy() | ||
|
||
# ============================================================================= | ||
# La clase SpreadsheetConverter traduce una celda con la forma 'A1' a una | ||
# coordenada de matriz m[0][0] | ||
# ============================================================================= | ||
|
||
class SpreadsheetConverter(object): | ||
|
||
def __init__(self, m:np.array, cell_ref:str): | ||
|
||
self.m = m # matriz con máximo 26 "columnas" | ||
self.cell_ref = cell_ref # celda con forma 'A1' | ||
|
||
|
||
def array_coord(self) -> str: | ||
r1 = self.to_cols() | ||
r2 = self.to_rows() | ||
|
||
r ="m[{}][{}]".format(r2, r1) | ||
|
||
return r | ||
|
||
def array_query(self) -> str: | ||
r1 = self.to_cols() | ||
r2 = self.to_rows() | ||
|
||
r = m[r2][r1] | ||
|
||
return r | ||
|
||
|
||
@classmethod | ||
def to_rows(self) -> int : | ||
dict1 = defaultdict(dict) | ||
for i in range(m.shape[0]): | ||
dict1[i] = i - 1 | ||
|
||
|
||
row = dict1[int(cell_ref[1:])] | ||
|
||
return row | ||
|
||
@classmethod | ||
def to_cols(self) -> int: | ||
dict2 = {'A':0,'B':1,'C':2,'D':3,'E':4,'F':5, | ||
'G':6,'H':7,'I':8,'J':9,'K':10,'L':11, | ||
'M':12,'N':13,'O':14,'P':15,'Q':16,'R':17, | ||
'S':18,'T':19,'U':20, 'V':21,'W':22,'X':23, | ||
'Y':24,'Z':25} | ||
|
||
col = dict2[cell_ref[0].upper()] | ||
|
||
return col | ||
|
||
|
||
############################################################################## | ||
|
||
cell_ref = "Z25" | ||
sc = SpreadsheetConverter(m, cell_ref) | ||
|
||
sc.array_coord() | ||
sc.array_query() | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Binary file not shown.
Oops, something went wrong.