Category "pandas"

ValueError: Incompatible indexer with Series while adding date to Date to Data Frame

I am new to python and I can't figure out why I get this error: ValueError: Incompatible indexer with Series. I am trying to add a date to my data frame. The da

Problem when importing statsmodels.regression.rolling (AttributeError: 'pandas._libs.properties.CachedProperty' object has no attribute 'func')

When I run the below code: from statsmodels.regression import rolling I get this error message: AttributeError Traceback (most recen

Django - Create downloadable Excel file using Pandas & Class Based View

I'm relatively new to Django and have been looking for a way to export my DataFrame to Excel using Pandas and CBV. I have found this code: from django.http impo

Update patch edge colours in Geopandas plot

I've plotted a GeoDataFrame as a choropleth using the following code (geopandas 0.2.1, matplotlib 2.0.2, in a Jupyter notebook, using %inline: fig, ax = plt.su

How do I subset the columns of a dataframe based on the index of another dataframe?

The rows of clin.index (row length = 81) is a subset of the columns of common_mrna (col length = 151). I want to keep the columns of common_mrna only if the col

Using categorical variables in statsmodels OLS class

I want to use statsmodels OLS class to create a multiple regression model. Consider the following dataset: import statsmodels.api as sm import pandas as pd im

Merging two dataframes without losing data

I have two dataframes: df_1 = Material TypeOf 4100 N200 4101 M200 4200 M200 4500 N200 .

Integer out of range when inserting large number of rows to postgress

I have tried multiple solutions and way around to solve this issue, probably something is still I am missing. I want to insert a list of values to my database.

retrieve only months with at least 28 sample days - pandas dataframe

Hello to the people of the web, I have a dataframe containing 'DATE' (datetime) as index and TMAX as column with values: tmax dataframe What i'm trying to do is

randomly split dataframe into groups with even distribution of values

I have a dataframe of two groups (A and B) and within those groups, 6 subgroups (a, b, c, d, e, and f). Example data below: index group subgroup value 0

scraping pdf files multiple pages from url

I want to scrape the information on this PDF in python. I'm not sure where to start because it isn't organized at all. I'm used to scraping HTML. I tried conver

How do I reorder a long string of concatenated date and timestamps seperated by commas using Python?

I have a string type column called 'datetimes' that contains multiple dates with their timestamps, and I'm trying to extract the earliest and last dates (withou

How do I reorder a long string of concatenated date and timestamps seperated by commas using Python?

I have a string type column called 'datetimes' that contains multiple dates with their timestamps, and I'm trying to extract the earliest and last dates (withou

How to create variables based on column names in dataframe?

I wanted to create variables in python based on the column names of my dataframe. Not sure if this is possible as I am quite new to Python. Lets say my df looks

How to create variables based on column names in dataframe?

I wanted to create variables in python based on the column names of my dataframe. Not sure if this is possible as I am quite new to Python. Lets say my df looks

AttributeError: Can't get attribute '_unpickle_block'

While using: with open("data_file.pickle", "rb") as pfile: raw_data = pickle.load(pfile) I get the error: AttributeError: Can't get attribute '_unpickle

RangeIndex object is not callable

I am reading values from text file and and trying to find index of sub strings like below df=pd.read_csv('break_sent.txt', index_col=False,encoding='utf-8',del

Python: pandas merge multiple dataframes

I have diferent dataframes and need to merge them together based on the date column. If I only had two dataframes, I could use df1.merge(df2, on='date'), to do

how to remove milliseconds or decimals in a specific dataframe column

I have 2 columns containing date and time(hr,min,seconds:milliseconds) How do I remove the milliseconds from only one of the column? Name MinTime

Stratified Sampling in Pandas

I've looked at the Sklearn stratified sampling docs as well as the pandas docs and also Stratified samples from Pandas and sklearn stratified sampling based on