You need to specify data
, index
and columns
to DataFrame
constructor, as in:
>>> pd.DataFrame(data=data[1:,1:], # values ... index=data[1:,0], # 1st column as index ... columns=data[0,1:]) # 1st row as the column names
edit: as in the @joris comment, you may need to change above to np.int_(data[1:,1:])
to have correct data type.
Related Posts:
- ValueError: Unknown label type: ‘continuous’
- How to fix IndexError: invalid index to scalar variable
- Convert pandas dataframe to NumPy array
- ImportError: Missing required dependencies [‘numpy’]
- Python Pandas – Missing required dependencies [‘numpy’] 1
- ‘DataFrame’ object has no attribute ‘sort’
- ‘DataFrame’ object has no attribute ‘sort’
- TypeError: cannot unpack non-iterable int objec
- ‘DataFrame’ object has no attribute ‘sort’
- What is dtype(‘O’), in pandas?
- What is dtype(‘O’), in pandas?
- TypeError: ‘DataFrame’ object is not callable
- ValueError: ‘object too deep for desired array’
- What does axis in pandas mean?
- How to take column-slices of dataframe in pandas
- Normalize data in pandas
- pandas create new column based on values from other columns / apply a function of multiple columns, row-wise
- Building multi-regression model throws error: `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).`
- Coalesce values from 2 columns into a single column in a pandas dataframe
- Concat DataFrame Reindexing only valid with uniquely valued Index objects
- Replacing Pandas or Numpy Nan with a None to use with MysqlDB
- Difference between data type ‘datetime64[ns]’ and ‘
- Merging two DataFrames
- Calculate weighted average using a pandas/dataframe
- vectorize conditional assignment in pandas dataframe
- ImportError: DLL load failed: The specified module could not be found
- Constructing pandas DataFrame from values in variables gives “ValueError: If using all scalar values, you must pass an index”
- Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
- Writing a pandas DataFrame to CSV file
- Pandas DataFrame Groupby two columns and get counts
- How to fix ‘Object arrays cannot be loaded when allow_pickle=False’ for imdb.load_data() function?
- How to show all columns’ names on a large pandas dataframe?
- TypeError: unhashable type: ‘numpy.ndarray’
- Plotting a 2D heatmap with Matplotlib
- What does numpy.random.seed(0) do?
- Python Pandas Counting the Occurrences of a Specific value
- What does the c underscore expression `c_` do exactly?
- Count unique values per groups with Pandas
- DataFrame constructor not properly called
- Convert pandas Series to DataFrame
- Error: all the input array dimensions except for the concatenation axis must match exactly
- How to iterate over rows in a DataFrame in Pandas
- Pandas: ValueError: cannot convert float NaN to integer
- How to find all occurrences of an element in a list
- TypeError: ‘numpy.float64’ object is not callable
- TypeError: ‘numpy.float64’ object is not callable
- ValueError: Length of values does not match length of index | Pandas DataFrame.unique()
- Convert a tensor to numpy array in Tensorflow?
- pandas: merge (join) two data frames on multiple columns
- filename.whl is not a supported wheel on this platform
- TypeError: ‘numpy.float64’ object is not callable?
- Why do I get: “Length of values does not match length of index” error?
- Convert a tensor to numpy array in Tensorflow?
- How can the Euclidean distance be calculated with NumPy?
- How to get element-wise matrix multiplication (Hadamard product) in numpy?
- ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224)
- Overflow Error in Python’s numpy.exp function
- Purpose of `numpy.log1p( )`?
- Pytorch tensor to numpy array
- ‘numpy.float64’ object is not iterable
- Group by index + column in pandas
- Can’t broadcast input array from shape (3,1) into shape (3,)
- Convert a Pandas DataFrame to a dictionary
- How do I calculate percentiles with python/numpy?
- Selecting with complex criteria from pandas.DataFrame
- deleting rows in numpy array
- module ‘pandas’ has no attribute ‘rolling_mean’
- Count unique values using pandas groupby
- Ignoring NaNs with str.containsv
- No numeric types to aggregate – change in groupby() behaviour?
- Saving a Numpy array as an image
- Solution for SpecificationError: nested renamer is not supported while agg() along with groupby()
- Pandas split DataFrame by column value
- Using numpy to build an array of all combinations of two arrays
- Can’t update to numpy 1.13 with anaconda?
- Matplotlib: TypeError: can’t multiply sequence by non-int of type ‘numpy.float64’
- TypeError: only integer arrays with one element can be converted to an index 3
- AttributeError: ‘Series’ object has no attribute ‘reshape’
- Numpy, multiply array with scalar
- Python 3: Multiply a vector by a matrix without NumPy
- datetime to string with series in pandas
- How to add a new row to an empty numpy array
- pandas groupby sort within groups
- Numpy – add row to array
- if else function in pandas dataframe
- Read data (.dat file) with Pandas
- Is there any numpy group by function?
- Boolean Series key will be reindexed to match DataFrame index
- Converting Pandas dataframe into Spark dataframe error
- Mean Squared Error in Numpy?
- Is there a head and tail method for Numpy array?
- pandas: multiple conditions while indexing data frame – unexpected behavior
- How to print a specific row of a pandas DataFrame?
- Logical operators for Boolean indexing in Pandas
- Transposing a 1D NumPy array
- numpy.float64 object is not iterable…but I’m NOT trying to
- How to update Pandas from Anaconda and is it possible to use eclipse with this last
- Python OpenCV2 (cv2) wrapper to get image size?
- Compare two columns using pandas
- alueError: ordinal must be >= 1