MY code is as follows for spyder
import numpy as np
price=np.genfromtxt("stocks.csv",delimiter=",")
I am getting this error
raise IOError("%s not found." % path)
OSError: stocks.csv not found.
How can I fix this
Make sure you have the file present in the working directory
with name "stocks.csv".
The file which you are trying to read is NOT PRESENT.
If You dont have the file, You need to create one in the same
working directory as your python program.
Create a csv file using microsoft excel and name it as stocks.csv.
Add the data accordigly.
PLEASE COMMENT if there is any concern. I will respond to
comments
MY code is as follows for spyder import numpy as np price=np.genfromtxt("stocks.csv",delimiter=",") I am getting this...
This is my code: import numpy as np import pandas as pd import sys from keras.models import Sequential from keras.layers import Dense from sklearn.preprocessing import StandardScaler from keras.layers.normalization import BatchNormalization from keras.layers import Dropout file_full=pd.read_csv("/Users/anwer/Desktop/copy/FULL.csv") file_bottom=pd.read_csv("/Users/anwer/Desktop/copy/bottom.csv") train=[] train_targets=[] test=[] test_targets=[] p=[] q=[] # We will generate train data using 50% of full data and 50% of bottom data. #is train target for labeling ? yes for train data train_df = file_full[:len(file_full)//2] labels=[ 0 for i in range(len(file_full)//2)] train_df=train_df.append(file_bottom[:len(file_bottom)//2]) for...
Python...I don't know what is wrong with my code: import numpy as np from mpi4py import MPI array= [14,175, 15,055, 16,616, 17,495, 18,072, 19,390] array1,array2= array[ : :2], array[1: :2] print (array1) print (array2) /////it should print array1 = [1,4175, 16,616,18,072] array2= [15,055, 17,495, 19,390]
IN PYTHON 3 GIVING THIS CODE %matplotlib inline import numpy as np import matplotlib.pyplot as plt from sklearn import datasets N_samples = 2000 X = np.array(datasets.make_circles(n_samples=N_samples, noise=0.05, factor=0.3)[0]) plt.scatter(X[:,0], X[:,1], alpha=0.8, s=64, edgecolors='white'); Use Spectral Clustering to cluster the points and visualize your result
why doesnt this work it isnt checking nans propperly import numpy as np import time x = np.linspace(-2,-1,100) y = np.linspace(-1.5,1.5,100) z0 = 0 z1s = [] for i in x: for k in y: z1 = (z0)**2 + i + k*1j z0 = z1 if np.real(z0) == np.nan:########## this doesnt work. it never detects nans print('nan') ### this NEVER prints. it should print after about 10 seconds pass if np.real(z0) != np.nan: print('not nan') z1s.append(z1) print(z1) time.sleep(1) print(z1s) ##################################...
I am currently doing homework for my java class and i am getting an error in my code. import java.util.Scanner; import java.util.Random; public class contact { public static void main(String[] args) { Random Rand = new Random(); Scanner sc = new Scanner(System.in); System.out.println("welcome to the contact application"); System.out.println(); int die1; int die2; int Total; String choice = "y";...
I am getting this Error can you please fix my Java
code.
import java.awt.Dialog;
import java.awt.Label;
import java.awt.TextArea;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Fall_2017 {
public TextArea courseInput;
public Label textAreaLabel;
public JButton addData;
public Dialog confirmDialog;
HashMap<Integer, ArrayList<String>> students;
public Fall_2017(){
courseInput = new TextArea(20, 40);
textAreaLabel = new Label("Student's data:");
addData = new JButton("Add...
I need help with the code below. I am getting an error message I am not sure how to fix import java.util.Scanner; public class DriveTestExams { public static vice main (String[] args);{ Scanner KB = new Scanner (System.in); int IncorrectAns; String[]CA = {"A", "D", "B", "B", "C", "B","A", "B","C", "D","A", "C","D", "B","D", "C","C", "A","D", "A"}; String[]SA = new String [20]; Boolean RightChoice = true; int IncorrectAns = 0; for(int i=o; i <=20; i++){ while (rightchoices); System.out.prinlin ("please enter answer for...
Hi. It's a python and I got an error below comment import numpy as np arr=np.genfromtxt("/Volumes/Samsung SSD 860 EVO 500GB Media/Download/primenumbers.txt", dtype=int) arr=arr.reshape(-1,1) arr.shape def find_cat(x): if x<= 300: return '<=300' elif x <= 600: return '<=600' else: return '<=1000' arr2 = np.apply_along_axis(find_cat, axis=1, arr=arr) arr2 = arr2.reshape(-1,1) arr3 = np.hstack((arr, arr2)) arr_300 = np.array((col[0] for col in arr3 if col[i]=='<=300'), dtype=int) arr_300 arr_300.shape count_300=len(arr_300) count_300 avg_300=round(np.mean(arr_300, 2) avg_300 print("Number of items in category \ "<=300\"= (one), and average of...
PYTHON: I have a numpy array that holds a name and a phone number such as this one. import numpy as np import pandas as pd LIST = np.array([("James", "Kirk", "512-375-5585"), ("Richard", "Branson, "1234567890"), ("James", "Bond", "34567")]) Then I stuff it into a data frame by doing this df = pd.DataFrame(List, columns=('Firstname', 'Lastname', 'Phone')) How would I go about changing 10 digit phone numbers such as 1234567890 into 123-456-7890 and discarding invalid ones such as 34567 so it reflects in...
I am almost done with this code, but for some reason I am still getting an error message: Some of the instructions were: Using a loop, prompt for a currency to find. Inside the loop that manages the input, call the lookUpCurrency() method can pass the inputted currency code value. The lookUpCurrency() method needs to loop through the list of currencies and compare the passed currency code with the code in the array. If found, return true - otherwise return...