Linked Questions

3 votes
4 answers
19k views

I have a numpy array and I want to convert it into a dataframe. import numpy as np import pandas as pd nparray = np.array([[1,2,3,4,5],[6,7,8,9,10]]) How do I convert it into a dataframe where ...
Aditya's user avatar
  • 131
0 votes
0 answers
247 views

I have a numpy array with the following shape: numpy_x.shape (9982, 26) I want turn this numpy to dataframe: x_new_df = pd.DataFrame(numpy_x) And my new dataframe is: x_new_df How to can I generate ...
bgarcial's user avatar
  • 3,263
0 votes
0 answers
48 views

Let say I have an array: array([('a', 1), ('b', 2), ('c', 3), ..., ('x', 24), ('y', 25), ('z', 26)], dtype=object) How do I split it into 2 columns as in 'alphabet' and 'order'? Much ...
Henry Li's user avatar
17 votes
1 answer
56k views

I want to create a pandas dataframe with default values of zero, but one column of integers and the other of floats. I am able to create a numpy array with the correct types, see the values variable ...
bfcondon's user avatar
  • 229
13 votes
4 answers
39k views

I want to set the value of a pandas column as a list of strings. However, my efforts to do so didn't succeed because pandas take the column value as an iterable and I get a: ValueError: Must have ...
Unni's user avatar
  • 5,944
8 votes
3 answers
27k views

In trying to get familiar with DataFrame in Python I got stuck in the following step... I try to create a dataframe from an array: from numpy import * import pandas as pd dat = array([[0....
Antoni Parellada's user avatar
-1 votes
2 answers
5k views

I have a numpy array in pyspark and I would like to convert this to a DataFrame so I can write it out as a csv to view it. I read the data in initially from a DataFrame however I had to convert to an ...
Taylrl's user avatar
  • 3,959
1 vote
2 answers
3k views

With the following class: class Test: a : str b : str and the following data frame: output = pd.DataFrame(columns=['a', 'b'] how can I convert an array, or list, of class Test into a pandas ...
Thomas's user avatar
  • 12.3k
3 votes
2 answers
11k views

I have a large npz file that l've loaded with numpy's np.load. I want to convert this to panda's dataframe so l can apply machine learning algorithms (KNN, K-Means, DT) using scikit-learn. I am new to ...
Artificial_Spark's user avatar
0 votes
3 answers
1k views

I have a list of lists, where the first list is a 'header' list and the rest are data lists. Each of these 'sub' lists are the same size, as shown below: list1 = [ ["Sno", "Name&...
Zenith_1024's user avatar
0 votes
3 answers
6k views

I am trying to append a numpy.darray to a dataframe with little success. The dataframe is called user2 and the numpy.darray is called CallTime. I tried: user2["CallTime"] = CallTime.values but I get ...
AlK's user avatar
  • 475
1 vote
1 answer
4k views

I have a dataset with three inputs and trying to predict next value of X1 with the combination of previous inputs values. My three inputs are X1, X2, X3, X4. So here I am trying to predict next ...
team's user avatar
  • 526
0 votes
1 answer
3k views

say I have a data frame,df, with columns: id |site| time| clicks |impressions I want to use the machine learning technique of k-fold cross validation ( split the data randomly into k=10 equal sized ...
seanv507's user avatar
  • 1,324
1 vote
2 answers
703 views

Say that I got this ndarray using numpy that I want to write to a text file. : [[1 2 3 4] [5 6 7 8] [9 10 11 12]] This is my code: width, height = matrix.shape with open('file....
singrium's user avatar
  • 3,056
1 vote
2 answers
908 views

I'm trying to read data from a .csv file using Pandas, smoothing it with Savitsky-Golay filter, filtering it and then using Pandas again to write an output csv file. Data must be converted from ...
user2882635's user avatar

15 30 50 per page