Error importing numpy in Google co lab using Android - python

I am trying to import numpy in Google co lab using Android but I am getting error shown in attached snap

As #Michael S. allready mentioned in the comments, Import needs to be lowercase:
import numpy as np

You must write the "I" in lowercase. Like that import numpy as np

Related

The data is already loaded from disk issue from mne

i am following this tutorial
M/EEG analysis with MNE Python
and i have a little errors in this fragment : 01:35:57 Working with BIDS data
i followed all the steps before and also implemented code :
import matplotlib.pyplot as plt
import pathlib
import matplotlib
import mne
import mne_bids
matplotlib.use('Qt5Agg')
directory ='C:/Users/User/mne_data/MNE-sample-data/MEG\sample/sample_audvis_raw.fif'
raw =mne.io.read_raw(directory)
#raw.plot()
#plt.show()
events =mne.find_events(raw)
#print(events)
event_id ={
"Auditory/Left":1,
"Auditory/Right":2,
"Visual/Left":3,
"Visual/Right":4,
"Smiley":5,
"Button":32
}
raw.info['line_freq']=60
raw.load_data()
out_path =pathlib.Path("out_data/sample_bids")
bids_path =mne_bids.BIDSPath(subject='01',session='01',task='audiovisual',run='01',root=out_path)
mne_bids.write_raw_bids(raw,bids_path=bids_path,events_data=events,event_id=event_id,overwrite=True)
but when i am running this code, i am getting issue :
ValueError: The data is already loaded from disk and may be altered. See warning for "allow_preload".
i can't understand reason of this error, how can i fix it?please helo me

Run markdown in pycharm with R and python chunks using reticulate

Really difficult to find anyone using markdown in a python IDE (I am using pycharm), with both R and python chunks.
Here is my code so far; I am just trying to set up my markdown to use both R and python code; it seems like my python chunk doesn't work; any idea why? Thanks!
R environment
library(readODS) # excel data
library(glmmTMB) # mixed models
library(car) # ANOVA on mixed models
library(DHARMa) # goodness of fit of the model
library(emmeans) # post hoc
library(ggplot2) # plots
library(reticulate) # link between R and python
use_python('C:/Users/saaa/anaconda3/envs/Python_projects/python.exe')
Python environment
import pandas as pd
import os
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns

Pkl.File import can't be read "ValueError: unsupported pickle protocol: 5"

here the exemplary code:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import pickle5 as pickle
#Read
output = pd.read_pickle("Energy_data.pkl")
plt.figure()
#print(output)
output.plot()
I am using Python 3.7 and that is probably the reason for the error message, because this .pkl files were created in Python 3.8 . If my colleague runs it (he created the .pkl-Files), it'll work.
I tried to use this solution (maybe I did not do it correctly) shown here, but it did not work anyway. Can someone show me how to import the pkl files using the example above in Python 3.7?
Thank you very much in advance!

RDKit not drawing Chlorin

I'm working with this molecule found in the the pdb database.
https://pubchem.ncbi.nlm.nih.gov/compound/65106
When I go to use the MoltoSMILES module, I'm not getting anything in return, or it seems to inconsistent. Here is my code I use in Jupyter Notebook. Another issue I'm having is minor, but I'd like to use Spyder. I notice the figure never draws in Spyder so I switched to Jupyter. Anyways, here is the code, and I'll show differnt SMILES formats I've either found of generated:
#%% Modules
import pandas as pd
from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import Draw
from rdkit.Chem import rdDepictor
from rdkit.Chem import PandasTools
IPythonConsole.ipython_useSVG=True
from rdkit.Chem import rdRGroupDecomposition
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.warning')
import rdkit
print(rdkit.__version__)
#%% Create Chlorin Scaffold
scaffold=Chem.MolFromSmiles('C1CC2=NC1=CC3=CC=C(N3)C=C4C=CC(=N4)C=C5C=CC(=C2)N5')
scaffold
I have also tried a couple of other SMILES strings I found in the pdb database, wikipedia, and that I've generated with OpenBable. Here they are:
C1CC2=NC1=CC3=CC=C(N3)C=C4C=CC(=N4)C=C5C=CC(=C2)N5
C(N1)(/C=C2N=C(C=C\2)/C=C3N/C(C=C\3)=C\4)=CC=C1/C=C5CCC4=N/5
[nH]1/c/2=C\C3=N/C(=C\c4ccc([nH]4)/C=C\4/C=CC(=N4)/C=c\1/cc2)/C=C3
None of them return the correct drawing. I'm not sure how to fix this. Is there a preference to SMILES format that RDKit expects? I'd mention that the bonding and atoms are correct, but the final shape is the only thing that's wrong.
Here's the image of what I would expect to see:
Thank you,
Let RDKit compute 2D coordinates and use the CoordGen library.
from rdkit import Chem
from rdkit.Chem import rdDepictor
rdDepictor.SetPreferCoordGen(True)
from rdkit.Chem.Draw import IPythonConsole
smiles = 'C1CC2=NC1=CC3=CC=C(N3)C=C4C=CC(=N4)C=C5C=CC(=C2)N5'
scaffold = Chem.MolFromSmiles(smiles)
rdDepictor.Compute2DCoords(scaffold)
To use Spyder, type scaffold in the console after you executed the code.

import error when using spafe library for feature extraction

I ' am working on audio file and need to use spafe library for lfcc, lpc... and i install the library as mentionned in the site : https://spafe.readthedocs.io/en/latest/
But when i try to extract some features , like lfcc, mfcc, lpc, i have import error par example when i use this code :
import scipy.io.wavfile
import spafe.utils.vis as vis
from spafe.features.mfcc import lfcc
i have this error :
ImportError: cannot import name 'lfcc'
I don't undestand because i can import spafe, i have all dependancies the libraries required with the correct versions ( numpy, scipy...).
There seems to be a typo in the docs example (which I guess tou are trying to follow); it should be
from spafe.features.lfcc import lfcc
i.e. lfcc, not mfcc (which mfcc indeed does not have a module lfcc, hence the error).

Categories

Resources