'CRF' object has no attribute 'keep_tempfiles' - pandas

I have imported `
from itertools import chain
import nltk
import sklearn
import scipy.stats
import sklearn_crfsuite
from sklearn_crfsuite import scorers,CRF
from sklearn_crfsuite.metrics import flat_classification_report
from sklearn_crfsuite import metrics`
Is there any way we can fix this on google colab?

Try this:
!pip install scikit-learn==0.22.2 --user
source: https://github.com/TeamHG-Memex/sklearn-crfsuite/issues/60

Related

Facebook prophet cannot import name 'lag_baomer' from 'convertdate.holidays'

I found issue when import fbprophet
ImportError: cannot import name 'lag_baomer' from 'convertdate.holidays'

Why df.interpotale() doesn't work in my python3? why does it return the exact same dataframe withut any interpolation?

my code for df.interpolate was:
import pandas as pd
import numpy as np
import xlrd
from IPython.display import display
from scipy import interpolate
pd.set_option('display.max_rows',54100)
df = pd.read_excel(r'C:\Users\User\Desktop\tanvir random practice\gazipur.xlsx', parse_date=["DateTime"], index_col='DateTime']
df.interpolate(method="linear").bfill()
display(df)

ModuleNotFoundError for .vision and .utils , download_url, VisionDataset

I am trying to create a custom dataset in google colab, but imports give me errors.
from PIL import Image
from six.moves import zip
import os
from .vision import VisionDataset ------------------------(1)
from .utils import download_url, check_integrity --------------(2)
class datasetName(VisionDataset):
...
(1) error :
ModuleNotFoundError: No module named 'main.vision'; 'main' is
not a package
(2) error :
ModuleNotFoundError: No module named 'main.utils'; 'main' is
not a package
I have tried to add from torchvision import utils but it does not solve the error.
If I change to from torch.utils import download_url, check_integrity
then the error becomes:
ImportError: cannot import name 'download_url'
Please try the following import lines.
from torchvision.datasets.vision import VisionDataset
from torchvision.datasets.utils import download_url, check_integrity
Hope it helps!

Can't import QSound from PyQt5.QtGui

I'm trying to use QSound for my application, but whenever I try to import it I get the error:
ImportError: cannot import name 'QSound'
Using python console with no success, as:
from PyQt5 import QtGui
from PyQt5.QtGui import QSound
I tried to import it from PyQt5.QtCore and PyQt5 Same error.
As stated by #S. Nick , the correct import was
from PyQt5.QtMultimedia import QSound

Creating executable with Py2exe and matplotlib errors

I have been searching this forum and many others and cannot seem to get a good method of creating an executable. I have tried several different methods (py2exe, pyinstaller and cx_freeze) and all seem to give me some kind of error.
When i tried pyinstaller, I received the error that "no _imaging C module is installed". Everything I search says that it has to do with PIL, but my code is not using PIL.
When I tried py2exe, I keep receiving the following error:
File "Scout_Tool.py", line 18, in <module>
File "matplotlib\pyplot.pyc", line 95, in <module>
File "matplotlib\backends\__init__.pyc", line 25, in pylab_setup
ImportError: No module named backend_qt4agg
I am at a loss of what to do. My code contains the following imports:
import os
import csv
import wx
import time
import math
from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.pyplot import figure,show
from mpl_toolkits.basemap import Basemap
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
from numpy.random import rand
from datetime import datetime
import wx.calendar as cal
import numpy as npy
from pylab import *
import numpy as np
import matplotlib
import adodbapi
import sqlparse
import pylab
import annote_new
import cPickle as pickle
Does anyone have any suggestions on how to do a build of the executable using py2exe? What i have tried...
from distutils.core import setup
import py2exe
import matplotlib
setup(
windows=[{'script': r'Scout_Tool.py'}],
data_files=matplotlib.get_py2exe_datafiles(),
options={
r'py2exe': {
r'includes': r'ElementConfig',
r'includes': r'ColorConv',
r'includes': r'Tkinter',
r'includes': r're',
r'includes': r'math',
r'includes': r'sys',
r'includes': r'matplotlib',
r'includes': r'mpl_toolkits',
r'includes': r'matplotlib.backends.backend_wx',
r'dll_excludes': [r'MSVCP90.dll'],
}
},
)
Thanks for any help!
I am not fully sure this will fix your problem, but you should start by correcting that faulty options dictionary entry. In python, when you define a dictionary with the same key over and over, you are only going to get the last value. A key can only exist once:
options={
r'py2exe': {
r'includes': r'ElementConfig',
...
r'includes': r'mpl_toolkits',
r'includes': r'matplotlib.backends.backend_wx',
...
}
}
print options
#{'py2exe': {'includes': 'matplotlib.backends.backend_wx'}}
I suspect the result of this usage is py2exe not really finding any of your intended includes. includes should be a list:
options={
'py2exe':{
'includes': [
'ElementConfig',
'ColorConv',
'Tkinter',
're',
'math',
'sys',
'matplotlib',
'mpl_toolkits',
'matplotlib.backends.backend_wx'
],
'dll_excludes': ['MSVCP90.dll'],
}
},
If after this, it still complains about the backend missing, you can add another explicit entry:
'includes': [
...
'matplotlib.backends.backend_qt4agg'
],