Skip to main content
se añadieron 774 caracteres en el cuerpo
Origen Enlace
alvar
  • 21
  • 5

EDIT: SOLUCIONADO: El problema es que estaba considerando la basepath como archivo y no como carpeta. Aprovecho de agradecer a abulafia por hacerme ver el error. adjunto codigo para el que le interese:

import pyprind
import pandas as pd
import os

basepath = 'C:/aclImdb'

labels = {'pos': 1, 'neg': 0}
pbar = pyprind.ProgBar(50000)
df = pd.DataFrame()
for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(basepath, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path, file), 'r', encoding='utf-8') as infile:
                txt = infile.read()
            df = df.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
df.columns = ['review', 'sentiment']

He estado estudiando un libro de machine learning y me enfrento a este error que aun no puedo solucionar: ValueError: listdir: path too long for Windows, recurro a ustedes para ver si me pueden ayudar con esto, gracias

import pyprind
import pandas as pd
import os
from sys import argv
path = pd.read_csv("data", header=None)
path.head(3)

pbar = pyprind.ProgBar(50000)
labels = {'pos':1, 'neg':0}

path = path.to_string()

for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(path, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path,'r', encoding='utf-8')) as infile:
                txt = infile.read()
            path = path.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
path.columns = ['review', 'sentiment']

el error es:

ValueError                                Traceback (most recent call last)
<ipython-input-15-d83afc0ae5a8> in <module>
      2     for l in ('pos', 'neg'):
      3         path = os.path.join(path, s, l)
----> 4         for file in os.listdir(path):
      5             with open(os.path.join(path,'r', encoding='utf-8')) as infile:
      6                 txt = infile.read()

ValueError: listdir: path too long for Windows  ``` 


EDIT: SOLUCIONADO, problema es que estaba considerando basepath como archivo y no carpeta. Para el que le interese el codigo es como sigue:

`
import pyprind
import pandas as pd
import os

basepath = 'C:/aclImdb'

labels = {'pos': 1, 'neg': 0}
pbar = pyprind.ProgBar(50000)
df = pd.DataFrame()
for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(basepath, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path, file), 'r', encoding='utf-8') as infile:
                txt = infile.read()
            df = df.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
df.columns = ['review', 'sentiment']
`



He estado estudiando un libro de machine learning y me enfrento a este error que aun no puedo solucionar: ValueError: listdir: path too long for Windows, recurro a ustedes para ver si me pueden ayudar con esto, gracias

import pyprind
import pandas as pd
import os
from sys import argv
path = pd.read_csv("data", header=None)
path.head(3)

pbar = pyprind.ProgBar(50000)
labels = {'pos':1, 'neg':0}

path = path.to_string()

for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(path, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path,'r', encoding='utf-8')) as infile:
                txt = infile.read()
            path = path.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
path.columns = ['review', 'sentiment']

el error es:

ValueError                                Traceback (most recent call last)
<ipython-input-15-d83afc0ae5a8> in <module>
      2     for l in ('pos', 'neg'):
      3         path = os.path.join(path, s, l)
----> 4         for file in os.listdir(path):
      5             with open(os.path.join(path,'r', encoding='utf-8')) as infile:
      6                 txt = infile.read()

ValueError: listdir: path too long for Windows  ``` 


EDIT: SOLUCIONADO, problema es que estaba considerando basepath como archivo y no carpeta. Para el que le interese el codigo es como sigue:

`
import pyprind
import pandas as pd
import os

basepath = 'C:/aclImdb'

labels = {'pos': 1, 'neg': 0}
pbar = pyprind.ProgBar(50000)
df = pd.DataFrame()
for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(basepath, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path, file), 'r', encoding='utf-8') as infile:
                txt = infile.read()
            df = df.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
df.columns = ['review', 'sentiment']
`



EDIT: SOLUCIONADO: El problema es que estaba considerando la basepath como archivo y no como carpeta. Aprovecho de agradecer a abulafia por hacerme ver el error. adjunto codigo para el que le interese:

import pyprind
import pandas as pd
import os

basepath = 'C:/aclImdb'

labels = {'pos': 1, 'neg': 0}
pbar = pyprind.ProgBar(50000)
df = pd.DataFrame()
for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(basepath, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path, file), 'r', encoding='utf-8') as infile:
                txt = infile.read()
            df = df.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
df.columns = ['review', 'sentiment']

He estado estudiando un libro de machine learning y me enfrento a este error que aun no puedo solucionar: ValueError: listdir: path too long for Windows, recurro a ustedes para ver si me pueden ayudar con esto, gracias

import pyprind
import pandas as pd
import os
from sys import argv
path = pd.read_csv("data", header=None)
path.head(3)

pbar = pyprind.ProgBar(50000)
labels = {'pos':1, 'neg':0}

path = path.to_string()

for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(path, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path,'r', encoding='utf-8')) as infile:
                txt = infile.read()
            path = path.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
path.columns = ['review', 'sentiment']

el error es:

ValueError                                Traceback (most recent call last)
<ipython-input-15-d83afc0ae5a8> in <module>
      2     for l in ('pos', 'neg'):
      3         path = os.path.join(path, s, l)
----> 4         for file in os.listdir(path):
      5             with open(os.path.join(path,'r', encoding='utf-8')) as infile:
      6                 txt = infile.read()

ValueError: listdir: path too long for Windows  ``` 




se añadieron 700 caracteres en el cuerpo
Origen Enlace
alvar
  • 21
  • 5
import pyprind
import pandas as pd
import os
from sys import argv
path = pd.read_csv("data", header=None)
path.head(3)

pbar = pyprind.ProgBar(50000)
labels = {'pos':1, 'neg':0}

path = path.to_string()

for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(path, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path,'r', encoding='utf-8')) as infile:
                txt = infile.read()
            path = path.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
path.columns = ['review', 'sentiment']

el error es:

ValueError                                Traceback (most recent call last)
<ipython-input-15-d83afc0ae5a8> in <module>
      2     for l in ('pos', 'neg'):
      3         path = os.path.join(path, s, l)
----> 4         for file in os.listdir(path):
      5             with open(os.path.join(path,'r', encoding='utf-8')) as infile:
      6                 txt = infile.read()

ValueError: listdir: path too long for Windows  ``` 


EDIT: SOLUCIONADO, problema es que estaba considerando basepath como archivo y no carpeta. Para el que le interese el codigo es como sigue:

`
import pyprind
import pandas as pd
import os

basepath = 'C:/aclImdb'

labels = {'pos': 1, 'neg': 0}
pbar = pyprind.ProgBar(50000)
df = pd.DataFrame()
for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(basepath, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path, file), 'r', encoding='utf-8') as infile:
                txt = infile.read()
            df = df.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
df.columns = ['review', 'sentiment']
`



import pyprind
import pandas as pd
import os
from sys import argv
path = pd.read_csv("data", header=None)
path.head(3)

pbar = pyprind.ProgBar(50000)
labels = {'pos':1, 'neg':0}

path = path.to_string()

for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(path, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path,'r', encoding='utf-8')) as infile:
                txt = infile.read()
            path = path.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
path.columns = ['review', 'sentiment']

el error es:

ValueError                                Traceback (most recent call last)
<ipython-input-15-d83afc0ae5a8> in <module>
      2     for l in ('pos', 'neg'):
      3         path = os.path.join(path, s, l)
----> 4         for file in os.listdir(path):
      5             with open(os.path.join(path,'r', encoding='utf-8')) as infile:
      6                 txt = infile.read()

ValueError: listdir: path too long for Windows  ``` 







import pyprind
import pandas as pd
import os
from sys import argv
path = pd.read_csv("data", header=None)
path.head(3)

pbar = pyprind.ProgBar(50000)
labels = {'pos':1, 'neg':0}

path = path.to_string()

for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(path, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path,'r', encoding='utf-8')) as infile:
                txt = infile.read()
            path = path.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
path.columns = ['review', 'sentiment']

el error es:

ValueError                                Traceback (most recent call last)
<ipython-input-15-d83afc0ae5a8> in <module>
      2     for l in ('pos', 'neg'):
      3         path = os.path.join(path, s, l)
----> 4         for file in os.listdir(path):
      5             with open(os.path.join(path,'r', encoding='utf-8')) as infile:
      6                 txt = infile.read()

ValueError: listdir: path too long for Windows  ``` 


EDIT: SOLUCIONADO, problema es que estaba considerando basepath como archivo y no carpeta. Para el que le interese el codigo es como sigue:

`
import pyprind
import pandas as pd
import os

basepath = 'C:/aclImdb'

labels = {'pos': 1, 'neg': 0}
pbar = pyprind.ProgBar(50000)
df = pd.DataFrame()
for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(basepath, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path, file), 'r', encoding='utf-8') as infile:
                txt = infile.read()
            df = df.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
df.columns = ['review', 'sentiment']
`



se añadieron 6 caracteres en el cuerpo
Origen Enlace
abulafia
  • 58.7k
  • 3
  • 54
  • 89

heHe estado estudiando un libro de machine learning y me enfrento a este error que aun no puedo solucionar: ValueError: listdir: path too long for WindowsValueError: listdir: path too long for Windows, recurro a ustedes para ver si me pueden ayudar con esto, gracias

He probado con descargar un software que se llama longpath tool , y un par de cosas más pero aun no puedo resolverlo. si alguien me ilumina seria e mucha ayuda saludos

The IMDB movie review set can be downloaded from http://ai.stanford.edu/~amaas/data/sentiment/. After downloading the dataset, decompress the files.

The IMDB movie review set can be downloaded from http://ai.stanford.edu/~amaas/data/sentiment/. After downloading the dataset, decompress the files.El codigo es:

import pyprind
import pandas as pd
import os
from sys import argv
path = pd.read_csv("data", header=None)
path.head(3)

pbar = pyprind.ProgBar(50000)
labels = {'pos':1, 'neg':0}

path = path.to_string()

el codigo es:

for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(path, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path,'r', encoding='utf-8')) as infile:
                txt = infile.read()
            path = path.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
path.columns = ['review', 'sentiment']

el error es:

ValueError                                Traceback (most recent call last)
<ipython-input-15-d83afc0ae5a8> in <module>
      2     for l in ('pos', 'neg'):
      3         path = os.path.join(path, s, l)
----> 4         for file in os.listdir(path):
      5             with open(os.path.join(path,'r', encoding='utf-8')) as infile:
      6                 txt = infile.read()

ValueError: listdir: path too long for Windows  ``` 







he estado estudiando un libro de machine learning y me enfrento a este error que aun no puedo solucionar: ValueError: listdir: path too long for Windows, recurro a ustedes para ver si me pueden ayudar con esto, gracias

He probado con descargar un software que se llama longpath tool , y un par de cosas más pero aun no puedo resolverlo. si alguien me ilumina seria e mucha ayuda saludos

The IMDB movie review set can be downloaded from http://ai.stanford.edu/~amaas/data/sentiment/. After downloading the dataset, decompress the files.

import pyprind
import pandas as pd
import os
from sys import argv
path = pd.read_csv("data", header=None)
path.head(3)

pbar = pyprind.ProgBar(50000)
labels = {'pos':1, 'neg':0}

path = path.to_string()

el codigo es:

for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(path, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path,'r', encoding='utf-8')) as infile:
                txt = infile.read()
            path = path.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
path.columns = ['review', 'sentiment']

el error es:

ValueError                                Traceback (most recent call last)
<ipython-input-15-d83afc0ae5a8> in <module>
      2     for l in ('pos', 'neg'):
      3         path = os.path.join(path, s, l)
----> 4         for file in os.listdir(path):
      5             with open(os.path.join(path,'r', encoding='utf-8')) as infile:
      6                 txt = infile.read()

ValueError: listdir: path too long for Windows  ``` 







He estado estudiando un libro de machine learning y me enfrento a este error que aun no puedo solucionar: ValueError: listdir: path too long for Windows, recurro a ustedes para ver si me pueden ayudar con esto, gracias

He probado con descargar un software que se llama longpath tool , y un par de cosas más pero aun no puedo resolverlo. si alguien me ilumina seria e mucha ayuda saludos

The IMDB movie review set can be downloaded from http://ai.stanford.edu/~amaas/data/sentiment/. After downloading the dataset, decompress the files.

El codigo es:

import pyprind
import pandas as pd
import os
from sys import argv
path = pd.read_csv("data", header=None)
path.head(3)

pbar = pyprind.ProgBar(50000)
labels = {'pos':1, 'neg':0}

path = path.to_string()

for s in ('test', 'train'):
    for l in ('pos', 'neg'):
        path = os.path.join(path, s, l)
        for file in os.listdir(path):
            with open(os.path.join(path,'r', encoding='utf-8')) as infile:
                txt = infile.read()
            path = path.append([[txt, labels[l]]], ignore_index=True)
            pbar.update()
path.columns = ['review', 'sentiment']

el error es:

ValueError                                Traceback (most recent call last)
<ipython-input-15-d83afc0ae5a8> in <module>
      2     for l in ('pos', 'neg'):
      3         path = os.path.join(path, s, l)
----> 4         for file in os.listdir(path):
      5             with open(os.path.join(path,'r', encoding='utf-8')) as infile:
      6                 txt = infile.read()

ValueError: listdir: path too long for Windows  ``` 







se añadieron 152 caracteres en el cuerpo
Origen Enlace
alvar
  • 21
  • 5
Loading
se añadieron 1360 caracteres en el cuerpo
Origen Enlace
alvar
  • 21
  • 5
Loading
Origen Enlace
alvar
  • 21
  • 5
Loading