Skip to main content

All Questions

Tagged with
40 votes
3 answers
180k views

Extract csv file specific columns to list in Python

What I'm trying to do is plot the latitude and longitude values of specific storms on a map using matplotlib,basemap,python, etc. My problem is that I'm trying to extract the latitude, longitude, and ...
mikez1's user avatar
  • 695
22 votes
3 answers
173k views

ValueError: x and y must be the same size

import numpy as np import pandas as pd import matplotlib.pyplot as pt data1 = pd.read_csv('stage1_labels.csv') X = data1.iloc[:, :-1].values y = data1.iloc[:, 1].values from sklearn.preprocessing ...
user3521180's user avatar
  • 1,130
16 votes
3 answers
84k views

How to make grouper and axis the same length?

For my assignment I'm supposed to plot the tracks of 20 hurricanes on a map using matplotlib. However when I run my code I get the error: AssertionError:Grouper and axis must be the same length Here'...
mikez1's user avatar
  • 695
15 votes
2 answers
68k views

How to display image stored in pandas dataframe?

import pandas as pd from scipy import misc import numpy as np import matplotlib.pyplot as plt W = {'img':[misc.imread('pic.jpg')]} df = pd.DataFrame(W) # This displays the image plt.imshow(df.img1[0]...
PiccolMan's user avatar
  • 5,376
13 votes
3 answers
92k views

How to plot CSV data

I have a python code in which I read a csv file using pandas and store date and time in one column Datetime. Now i want to plot Sensor Value on y-axis and datatime on x-axis. How can i achieve this? ...
rushan's user avatar
  • 221
9 votes
1 answer
27k views

How to modify 2d Scatterplot to display color based off third array in csv file?

I am using Python and a CSV file. I am currently trying to modify the scatter plot(2d) below to change colors based on a third column in my csv file. After searching through multiple posts, I ...
Jonny's user avatar
  • 619
8 votes
2 answers
5k views

How to plot date data evenly along x-axis?

I am plotting data from a csv file with the values on the y-axis and the date on the x-axis. My dataset only includes data from June, July and August over a 15 year period. However, when I try to plot ...
glayne's user avatar
  • 175
8 votes
3 answers
78k views

How do I fix this type error ('value' must be an instance of str or bytes, not a float) on Python

I want to plot a graph for Covid-19 in India and so far there's no problem when I manually input my data as x and y axis. But since the data is quite long and when I want to read it as .csv file, it ...
Siti's user avatar
  • 93
7 votes
2 answers
40k views

pyplot x-axis being sorted

This is all on a windows 7 x64 bit machine, running python 3.4.3 x64 bit, in the PyCharm Educational edition 1.0.1 compiler. The data being used for this program is taken from the Citi Bike program in ...
ay-ay-ron's user avatar
  • 302
6 votes
1 answer
34k views

How to plot pie chart using data frame group by different range?

My Code is: import pandas as pd import matplotlib.pyplot as plt from matplotlib import style df=pd.read_csv("patient1.csv") a=df.loc[df.Age<18,['Age']] print(a) b=df.loc[(df.Age >= 18) & (...
Yash Singhvi's user avatar
6 votes
1 answer
19k views

Highlight specific points in matplotlib scatterplot

I have a CSV with 12 columns of data. I'm focusing on these 4 columns Right now I've plotted "Pass def" and "Rush def". I want to be able to highlight specific points on the scatter plot. For ...
jhaywoo8's user avatar
  • 767
5 votes
2 answers
6k views

Creating a live plot of CSV data with Matplotlib

I am trying to use Matplotlib to visualize some measurements. The measurements typically last about 24hrs and will include ~30k lines of data in the csv. I've been struggling mostly with getting my ...
MBlankfield's user avatar
4 votes
2 answers
27k views

How to plot a graph from csv in python

I have the following code and was wondering how to plot it as a graph in python year,month,sales,expenditure 2018,jan,6226,3808 2018,feb,1521,3373 2018,mar,1842,3965 2018,apr,2051,1098 2018,may,1728,...
user avatar
4 votes
1 answer
10k views

How to read the date/time field from the csv file and plot a graph accordingly in python

Im importing records from a CSV file using python csv module . The date/Time field expects the date to be in a specific format, but different spreadsheet programs default to different types of ...
AnveshVarma's user avatar
4 votes
1 answer
6k views

Python Pandas value counts for multiple columns and generate graph from the result

I have a csv to read from as follows A B C Sam 123 PID-213 Sam 145 PID-432 Sam 123 PID-546 Dan 786 PID-321 Dan 897 PID-432 and I want a group as below: count of unique B elements and Pids. (Bis ...
Rachel's user avatar
  • 247

15 30 50 per page
1
2 3 4 5
30