how to remove url in python colab?

Advertisements I am doing data cleaning for my dataset. How to remove the link "pic.twitter.com…." in Python for colab? here’s the picture of the link I want to remove Any suggestions are much appreciated. Thanks. #remove other links def removelinks(text): ** links = re.sub(r’????’)** return links.sub(r”,text) train_df[‘clean tweet’]= train_df[‘clean tweet’].apply(lambda x: removelinks(x)) train_df.head() >Solution :… Read More how to remove url in python colab?

How to use an unlisted Python Package with 'pyproject.toml' file in Google Colab

Advertisements I am trying to use an Unofficial Twitter API using python library called RedGalaxy on Google Colab. This package is not yet available on Pypi platform. I have tried to build the package in Google colab itself but wasn’t able to use it there. !git clone https://github.com/Ristellise/RedGalaxy.git !pip install -e ./RedGalaxy/. Output: Successfully built… Read More How to use an unlisted Python Package with 'pyproject.toml' file in Google Colab

How to Remove IndentationError: expected an indented block: except ValueError: in Google Colab

Advertisements Given a dataset I was asked to perform 5 machine learning models on the dataset. Here is my code: standard_scaler = StandardScaler() try: X_train=standard_scaler.fit_transform(X_train) X_test=standard_scaler.fit_transform(X_test) except ValueError: I keep getting except ValueError: ^ IndentationError: expected an indented block Can someone please help me figure out this issue? >Solution : You need a block in… Read More How to Remove IndentationError: expected an indented block: except ValueError: in Google Colab

passing external date variable to a query python

Advertisements desired_date = "2022-09-28" #@param {type:"date"} import pandas as pd df = pd.io.gbq.read_gbq(”’ SELECT * FROM `gdelt-bq.gdeltv2.geg_gcnlapi` WHERE DATE(date) = desired_date LIMIT 1000 ”’, project_id=project_id, dialect=’standard’) Trying to pass desired_date to the SQL query, but everything I seem to do results in the following error: Reason: 400 No matching signature for operator = for argument… Read More passing external date variable to a query python