Skip to main content
se añadieron 115 caracteres en el cuerpo
Origen Enlace
rexa
  • 21
  • 4

Tengo un archivo csv muzmuy grande, quiero salvar un pedazo solamente,---Quiero guardar solo grupo 20--- tengo:

Group 1|Group 1| 0| 0.0000000000000000 0 00000000 | 0.0000000000000000 000000000 | 0.0000000000000000
00000000 | 2| 2.5000625015625388E5000E-002 0 | 0.0000000000000000 000000000 | 0.000000000000000000000000 |
. . . 149| 148.90374759368984 1 | 1.4819356219977662E4819977662E-002 9| 9.3191136417201548E3191136E-003003|
149| 148.92874821870546 1 | 1.4807592487184622E4807592487E-002 9| 9.3658770834987894E3658770E-003003|
. . . Group 20|Group 20| 0| 0.0000000000000000 0 00000000 | 0.0000000000000000 000000000 | 0.000000000000000000000000 | | 2.5000E-002 | 0.00000000 | 0.00000000 |
. . . 149| 149.90374759368984 1 | 1.4819356219977662E4819977662E-002 9| 9.3191136417201548E3191136E-003003|
| 149.92874821870546 | 1.4807592487E-002 | 9.3658770E-003|
. . Group 200. 0|Group 200| | 0.0000000000000000 0 00000000 | 0.0000000000000000 000000000 | 0.000000000000000000000000 | | 2.5000E-002 | 0.00000000 | 0.00000000 |
. . . 149| 150.90374759368984 1 | 1.4819356219977662E4819977662E-002 9| 9.3191136417201548E3191136E-003003|
| 150.92874821870546 | 1.4807592487E-002 | 9.3658770E-003|

import pandas as pd  import numpy as np  dos =
pd.read_csv('file.txt',header=0,delimiter= '\s+', index_col=False)

while line := file.readline():
    read = line.rstrip()
    for i in line:
           if i == Group 20:
           group = []
           print(group)
        

Tengo un archivo csv muz grande, quiero salvar un pedazo solamente,---Quiero guardar solo grupo 20 tengo:

Group 1 0.0000000000000000 0.0000000000000000 0.0000000000000000
2.5000625015625388E-002 0.0000000000000000 0.0000000000000000
. . . 149.90374759368984 1.4819356219977662E-002 9.3191136417201548E-003
149.92874821870546 1.4807592487184622E-002 9.3658770834987894E-003
. . . Group 20 0.0000000000000000 0.0000000000000000 0.0000000000000000
. . . 149.90374759368984 1.4819356219977662E-002 9.3191136417201548E-003
. . . Group 200 0.0000000000000000 0.0000000000000000 0.0000000000000000
. . . 149.90374759368984 1.4819356219977662E-002 9.3191136417201548E-003

import pandas as pd  import numpy as np  dos =
pd.read_csv('file.txt',header=0,delimiter= '\s+', index_col=False)

while line := file.readline():
    read = line.rstrip()
    for i in line:
           if i == Group 20:
           group = []
           print(group)
        

Tengo un archivo csv muy grande, quiero salvar un pedazo solamente,---Quiero guardar solo grupo 20--- tengo:

|Group 1| | 0. 00000000 | 0.00000000 | 0.00000000 | | 2.5000E-002 | 0.00000000 | 0.00000000 |
. . . | 148.90374759368984 | 1.4819977662E-002 | 9.3191136E-003|
| 148.92874821870546 | 1.4807592487E-002 | 9.3658770E-003|
. . . |Group 20| | 0. 00000000 | 0.00000000 | 0.00000000 | | 2.5000E-002 | 0.00000000 | 0.00000000 |
. . . | 149.90374759368984 | 1.4819977662E-002 | 9.3191136E-003|
| 149.92874821870546 | 1.4807592487E-002 | 9.3658770E-003|
. . . |Group 200| | 0. 00000000 | 0.00000000 | 0.00000000 | | 2.5000E-002 | 0.00000000 | 0.00000000 |
. . . | 150.90374759368984 | 1.4819977662E-002 | 9.3191136E-003|
| 150.92874821870546 | 1.4807592487E-002 | 9.3658770E-003|

import pandas as pd  import numpy as np  dos =
pd.read_csv('file.txt',header=0,delimiter= '\s+', index_col=False)

while line := file.readline():
    read = line.rstrip()
    for i in line:
           if i == Group 20:
           group = []
           print(group)
        
Origen Enlace
rexa
  • 21
  • 4

Como encontrar una linea en csv file salvar el texto hasta la siguiente linea?

Tengo un archivo csv muz grande, quiero salvar un pedazo solamente,---Quiero guardar solo grupo 20 tengo:

Group 1 0.0000000000000000 0.0000000000000000 0.0000000000000000
2.5000625015625388E-002 0.0000000000000000 0.0000000000000000
. . . 149.90374759368984 1.4819356219977662E-002 9.3191136417201548E-003
149.92874821870546 1.4807592487184622E-002 9.3658770834987894E-003
. . . Group 20 0.0000000000000000 0.0000000000000000 0.0000000000000000
. . . 149.90374759368984 1.4819356219977662E-002 9.3191136417201548E-003
. . . Group 200 0.0000000000000000 0.0000000000000000 0.0000000000000000
. . . 149.90374759368984 1.4819356219977662E-002 9.3191136417201548E-003

import pandas as pd  import numpy as np  dos =
pd.read_csv('file.txt',header=0,delimiter= '\s+', index_col=False)

while line := file.readline():
    read = line.rstrip()
    for i in line:
           if i == Group 20:
           group = []
           print(group)