Trying to remove the first row in python fails?

Trying to remove the first row in python fails?

Hi I have some data in csv format, this is what the top of it looks like.

Hi I have some data in csv format, this is what the top of it looks like.

I have some very simple code that is just meant to remove the first row:

import numpy as np
import pandas as pd
data = pd.read_csv("mydata.csv")
data = data.drop(data.columns[[0]],axis=0)
data.to_csv("mydata2.csv")

However when run, I receieve this error:

Warning (from warnings module):
  File "C:/Users/george/Desktop/testing/output/PIVOTING.py", line 1
DtypeWarning: Columns (6) have mixed types. Specify dtype option on import or set low_memory=False.

Traceback (most recent call last): File "C:/Users/george/Desktop/testing/output/PIVOTING.py", line 5, in <module> data = data.drop(data.columns[[0]],axis=0) File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 3697, in drop errors=errors) File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 3111, in drop obj = obj._drop_axis(labels, axis, level=level, errors=errors) File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 3143, in _drop_axis new_axis = axis.drop(labels, errors=errors) File "C:\Python27\lib\site-packages\pandas\core\indexes\base.py", line 4404, in drop '{} not found in axis'.format(labels[mask])) KeyError: "['C'] not found in axis"


python numpy pandas

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Python Pandas Objects - Pandas Series and Pandas Dataframe

In this post, we will learn about pandas’ data structures/objects. Pandas provide two type of data structures:- ### Pandas Series Pandas Series is a one dimensional indexed data, which can hold datatypes like integer, string, boolean, float...

Python Data Science – A Free 12-Hour Course for Beginners. Learn Pandas, NumPy, Matplotlib

This free 12-hour Python Data Science course will take you from knowing nothing about Python to being able to analyze data. You'll learn basic Python, along with powerful tools like Pandas, NumPy, and Matplotlib. This is a hands-on course and you will practice everything you learn step-by-step. This course includes a full codebase for your reference [https://github.com/datapublishings/Course-python-data-science]. It kicks off with a one-hour introduction to basic programming concepts, proble

Python for Data Science - Learn Python, Pandas, NumPy, Matplotlib

Python tutorial for Data Science - Learn Python, Pandas, NumPy, Matplotlib, will take you from knowing nothing about Python to coding and analyzing data with Python using tools like Pandas, NumPy, and matplotlib. This is a hands-on course and you will practice everything you learn step-by-step.

Pythonic Data Cleaning With Pandas and NumPy

Get started with basic data cleaning techniques in Python using Pandas and NumPy. We’ll leverage Python’s Pandas and NumPy libraries to clean data.

Python for Machine Learning - NumPy & Pandas

This Python for Machine Learning Tutorial will help you learn the Python programming language from scratch. You'll learn about NumPy & Pandas in Python. Everything in this course is explained with the relevant example thus you will actually know how to implement the topics that you will learn in this course.