Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help with this error to make code work In [1]import pandas as pd import numpy as mp Import matplotlib.pyplot as plt In (]: path

need help with this error to make code work image text in transcribed
image text in transcribed
In [1]import pandas as pd import numpy as mp Import matplotlib.pyplot as plt In (]: path - Desktop/surname_data.csv data - pd. read_csv(path) In (14): data Out[14] array([[ MOTRA'). ['80'], [DHALIWAL), ["MIRAGHAN). [SHAFAIL ['BANAEI'll, dtype-object) In [17]: data.Lower-data.Lower.astype(str) AttributeError Traceback (most recent call last) cipython-input-17-6263781a617c> in codule> ---> 1 data. Lower-data Lower.astype(str AttributeError: "numpy.ndarray' object has no attribute 'Lower In [5]: data[ SRBMM'] - data[ "SRNM_M) In [6]: data - np.array(data[ SRNM_N'] [:10000]).reshape(-1,1) In [9]: data-[x.lower() for x in data[:,]] #convert nomes to Lowercase? AttributeError Traceback (most recent call last) in () 1 data - [x, lower() ----> 2 for x in data 1,0]] in distcomp> (0) 1 data - Ex lower() for x in data[:,]] AttributeError: 'float object has no attribute 'lower . [10]: data np.array(data).reshape(-1,1) [11]: print("Data Shape 0" format(data.shape)) print() print("lets see some nanes :") print(data[1:10]) Data Shape (1980e, 1) lets see some names : [[B'] [ 'DHALIWAL"] ["PITTAR"] [GUJG') ['ECLAIRE') [COCOZZA] ["HAGGAN] ['SCHIAVETTA'] ['MUGGERIDGE ]] [12]: transform_data- np.copy(data) [13]: max_length - for index in range(len(data)): max_length max(max_length, len(data[index, e))) TypeError Traceback (most recent call last) in () 1 max_length - @ 2 for index in range(len(data)) ---> 3 max_length-max(max_length, len (data[index, 0])) TypeError: object of type 'float' has no len() En [ ]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago