Category "pandas"

How can I plot a line chart with two different companies monthly sales from 12 months before and 12 months after

The dataframe is a snapshot of what I'm working with. What I want to achieve is a line chart of the monthly sales of the different brands. Months with '-' befor

Get only those rows from a pandas data frame where a particular value is not present in a data frame column of type list

One of my columns in dataframe is of type list. I want to get only those rows where color is not red.Output should give row 2 and 3. I tried def Removecolo

can i make my scraping (pandas read html) script faster?

i have a very simple script, it just scrapes some tables off the internet and inserts it into a db. however: tickerlist contains about 8000 rows. and the script

Selecting a subset of a dataframe based on a list - pandas

I am working with a large dataframe (ftp://ftp.ncbi.nlm.nih.gov/genomes/refseq/bacteria/assembly_summary.txt) with pandas in Python 3, using PyCharm. The column

iterate over a df and multiply the values by the values of another df

My df1 looks like this:It contains 3 unique project id.The date starts on 01-01-22 and ends on 01-12-28 id date p50 p90 apv1 01-01-22 1000 1000 apv2 01-01-22 1

filling missing data in pandas data set

I have annual stock data and some of the years, datas are missing for the columns : at, ebit, lt , ni, re, wcap. How can I fill these missing slots with the dat

ValueError: shapes and not aligned: (dim 2) != 4 (dim 0)

I am currently working on a script that does some array manipulating and calculations for modeling. I am running into an error and unsure how to solve it. from

Python 3 does not show the barchart

I am trying to make this bargraph appear in the python run screen. But for some reason, it does not show the graph on the screen. However, if I put this code on

Cannot get a file to be read into a list of stock tickers and then get yfinance data for each

I am trying to read a csv file into a dataframe and then iterate over each ticker to get some yahoo finance data, but I struggle with matching the right data ty

How to get colored legend with seaborn barplot

There is a problem with plt.legend in seaborn and matplotlib. What is wrong with it? I can't see the legend color. plt.figure(figsize=(30,10)) plt.xticks(rotati

Find differences between a set of csv files in folder 1 against a set of csv files in folder 2?

There are a number a files that need to be compared for differences in their rows; difference not as in subtraction but as in what values are different for each

Calculating rolling XNPV in Python

I need to calculate XNPV of cash flows at different future dates. Is there any function to do this in numpy, pandas or plain python? Consider a dataframe like s

Altair: encoding field is specified without a type

Hi my gorgeous friend on the Internet, I have a question about how to plot a Chart in Altair. I have been struggling with this error since yesterday and still h

how to split up a pandas series off of every two words in python

if I have a pandas dataframe with a description of an issue, how can I split each value into two separate words at a time? e.g Subject Number Issue 30493 "This

Why can one column of the pandas DataFrame not be filled?

I'm having some problems iteratively filling a pandas DataFrame with two different types of values. As a simple example, please consider the following initializ

How to fill na values of a column by checking another column

This image would help better: The column titled passengerId describes the group number and person number, people in the same group are usually families, hence

Trouble when trying to do a VLOOKUP like with two pandas dataframes

I've read a lot of questions regarding this matter, but none of it solved my problem. I have 2 dataframes, one containing a list of all students of graduation l

Inserting rows into Microsoft SQL Server using pandas raises precision error

I am trying to insert data into a mssql database. I needed as fast method for this so I set the fast_executemany param to true. The upload works fine for most p

Concat multiple dataframe and manage those that doesn't exist

I try to concat some dataframe - 30 dataframe of 24h data - that been created automatically with some csv, but sometimes csv doesn't exist, so the dataframe was

how to create a dataframe from a list of dictionary value?

I have a list - elements_listed = [{'data': {'data/2022/04/1': '26-Apr-2022 07:47', 'data/2022/04/2': '24-Apr-2022 17:27', 'data/2022/04/3': '22-Apr-2022 14:20'