Python for Machine Learning

list is mutable datatype
where as tuple is immutable data type

1 Like

How can I reverse a list in python without reverse function?

We can using slicing to achieve this task.Here is a simple example

x=[1,2,3]

y=x[::-1]

Now here y is the list which contains all the items of list x but in reverse order.

2 Likes

i want Machine Learning with Python all txt file

i want excel data file

Hello All,

I who do l contact for the certification .
I haven’t received mine yet

Thanks

Dear Learner,

Please drop a mail to academy@greatlearning.in mentioning the course name

I a looking to enroll for this course. Please let me know whether you got certificate or not.

I have just started with Python for Mah=chine Learning and completed a couple of videos but one of the video’s progress is stuck at 59%. How could I overcome this? If it will be like this then I will not be able to complete the course and will not get any certificate.

1 Like

Dear Learner,

Please drop a mail to academy@greatlearning.in mentioning the course name

How to delete a column in a DataFrame?

how to convert a pandas dataframe into a NumPy array.

I installed keras module in my system. But when I tried to import this module I got this below error : modulenotfounderror: no module named ‘keras’

How to create empty pandas dataframe?

I was following a tutorial about machine learning and following code works fine in tutorial but shows error when i try exact same thing:

from sklearn.cross_validation import train_test_split

It returns me this error:

ImportError: No module named sklearn.cross_validation

When running this code in TensorFlow,I got this error: module ‘tensorflow’ has no attribute ‘session’ .But it worked fine last time i ran it.

import tensorflow as tf

msg = tf.constant(‘Hello, TensorFlow!’)

sess = tf.Session()

print(sess.run(msg))

I am not able to run this script.It shows this error “ImportError: numpy.core.multiarray failed to import” about numpy and i have already numpy installed.Here is my script:

import cv2
import time

cv.NamedWindow(“camera”, 1)

capture = cv.CaptureFromCAM(0)

while True:
img = cv.QueryFrame(capture)
cv.ShowImage(“camera”, img)
if cv.WaitKey(10) == 27:
break
cv.DestroyAllWindows()

columns = [‘Col1’, ‘Col2’, … , ‘ColN’]

df.drop(columns, inplace=True, axis=1)

import numpy as np

import pandas as pd

indexs = [1, 2, 3, 4, 5, 6, 7]

a = [np.nan, np.nan, np.nan, 0.1, 0.1, 0.1, 0.1]

b = [0.2, np.nan, 0.2, 0.2, 0.2, np.nan, np.nan]

c = [np.nan, 0.5, 0.5, np.nan, 0.5, 0.5, np.nan]

df = pd.DataFrame({‘A’: a, ‘B’: b, ‘C’: c}, index=index)

df = df.rename_axis(‘ID’).values

print(df)

Have you installed keras properly.And if you have used anaconda to install ,sometimes we encounter such problems.Try pip to install keras after removing it first.

pip install keras