Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: How to gather specific second-level items from a list
Post: RE: How to gather specific second-level items from...

I added commas after the itemnamex and saved in a file ex.json. from json import load if __name__ == '__main__': with open("ex.json") as f: data = load(f) sum([d['run'] for d in data.values...
nealc General Coding Help 2 1,546 Dec-17-2021, 07:36 AM
    Thread: matplotlib.pyplot.show
Post: RE: matplotlib.pyplot.show

Hi Alienspecimen Interesting question, I found there is an interactive mode, in which plots are automatically displayed. You might be working in an environment which defaults to interactive mode. I...
nealc General Coding Help 2 2,232 Feb-27-2021, 01:52 AM
    Thread: IndexError: index 0 is out of bounds for axis 0 with size 0
Post: RE: IndexError: index 0 is out of bounds for axis ...

Maybe there's no data in that cell? If you can post a minimally reproducible example, you might get more answers..
nealc Data Science 2 5,465 Feb-27-2021, 12:53 AM
    Thread: How to sum across variable columns in a dataframe
Post: RE: How to sum across variable columns in a datafr...

Hi Rennerom That's a tricky one, maybe try apply: import pandas as pd from numpy import arange data = {'ID': ['a','b','c','d','e'], 'Target': [2,4,1,2,5], 'P1': [30,50,22.2,1,24....
nealc General Coding Help 2 2,751 Jan-28-2021, 07:08 AM
    Thread: Plotting A Time Series With Shaded Recession Bars
Post: RE: Plotting A Time Series With Shaded Recession B...

Perhaps an area plot or a bar plot (commented)? from pandas import read_csv import matplotlib.pyplot as plt from io import StringIO if __name__ == "__main__": df = read_csv(StringIO("""Date Rece...
nealc General Coding Help 1 3,157 Jan-24-2021, 09:08 PM
    Thread: Selecting rows that contain certain values using two alternatives
Post: RE: Selecting rows that contain certain values usi...

Maybe you're thinking of .xs? import pandas as pd if __name__ == "__main__": dataset = pd.DataFrame([(1,1,'a',10),(2,2,'b',20),(3,3,'c',30), (4,4,"Total",40)], columns=["a","b",...
nealc General Coding Help 1 1,582 Jan-24-2021, 08:34 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020